respaldar una mesa en SQL
CREATE TABLE backup_table SELECT * FROM table_to_be_backed_up;
Cooperative Chinchilla
CREATE TABLE backup_table SELECT * FROM table_to_be_backed_up;
BACKUP DATABASE my_db
TO DISK = 'C:\my_db_backup.bak';
CREATE TABLE actor_backup SELECT * FROM actor;
declare @name varchar(100) = 'tableName'
declare @timestamp varchar(100) =
replace(cast(convert(varchar, getdate(), 126) as varchar(10)), '-', '') + '_'
+ RIGHT('00' +cast(datepart(hour, getdate()) as varchar), 2)
+ RIGHT('00' + cast(datepart(minute, getdate()) as varchar), 2) + '_'
declare @query varchar(MAX) = 'select * into backup_' + @timestamp + @name + ' from ' + @name
--select @query
exec(@query)