La idea del código es crear un backup, usando BCP de SQL, en mi caso estoy usando Ms. SQL SERVER 2008 R2. CREATE PROCEDURE [dbo].[SP_TB_BACKUP] @FILTRO VARCHAR(20), @RUTA VARCHAR(200), @EXT VARCHAR(3) AS BEGIN --1.- CREACION DE LA TABLA CREATE TABLE #TABLE_TEMP (ITEM INT IDENTITY(1,1), NOMBRE_TB NVARCHAR(100), NOMBRE NVARCHAR(100), ONLYNAME NVARCHAR(100), ONLYSCHEMA NVARCHAR(100)) --2.- INSERTANDO EN LA TABLA INSERT INTO #TABLE_TEMP (NOMBRE_TB,NOMBRE,ONLYNAME,ONLYSCHEMA) SELECT ('['+table_catalog+'].['+table_schema+'].['+table_name+']') AS TABLENAME1,(table_schema+'.'+table_name) AS TABLENAME2, table_name AS ONLYNAME, TABLE_SCHEMA as ONLYSCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE table_name like '%'+@FILTRO+'%' ORDER BY table_name --3.- BUBLE TABLAS DECLARE @columnHeader V...
Comentarios