Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql server backup table

SELECT * INTO BackupTable FROM Table
Comment

SQL BACKUP DATABASE for SQL Server

BACKUP DATABASE databasename
TO DISK = 'filepath';
Comment

sql table backup

CREATE TABLE actor_backup SELECT * FROM actor;
Comment

backup table mssql

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)
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle select first row order by 
Sql :: alter table add multiple foreign key sql 
Sql :: create a sqlite database c# 
Sql :: oracle sql pad left zeros 
Sql :: extract weekday from date in sql 
Sql :: how to drop all tables in sql 
Sql :: vowels in sql 
Sql :: sql views 
Sql :: replace null value within column mysql 
Sql :: SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key" 
Sql :: show all event schedular on mysql 
Sql :: joomla execute raw sql 
Sql :: update with select postgresql 
Sql :: mysql change default collation 
Sql :: postgres regular expression replace 
Sql :: sql drop procedure 
Sql :: postgres list users 
Sql :: python sqlite data delete 
Sql :: how to query date in sql server 
Sql :: mysql delete duplicates 
Sql :: drop sequence 
Sql :: if in mysql 
Sql :: sql server add time to date 
Sql :: mysql delete entire row on condition 
Sql :: mysql compare timestamp in minutes 
Sql :: rename a column in sql server 
Sql :: mssql datetime to date 
Sql :: sql change data type 
Sql :: how to find average in sql 
Sql :: unique key in ms sql server 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =