SQL clearing Data Tables
Truncate table [tablename]
SQL reset primary key Seed
Dbcc checkident ([tbname], reseed, 0)
SQL Server network backup
To back up a database on the network to a local machine, you can use the following method:
Use Master
Go
-- MAP network drive
Exec XP_cmdShell 'net use z: http://www.cnblogs.com/moss_tan_jun/admin/file://garfield/temp "password"/user: garfield \ administrator'
Go
-- Backup database
Backup database pubs to disk = 'e: \ temp \ pubs. Bak'
Go
-- Copy backup
Exec xp_mongoshell 'Copy e: \ temp \ pubs. bak z: \ pubs. Bak'
Go
-- Delete backup
Exec XP_cmdShell 'del e: \ temp \ pubs. Bak'
Go
-- Delete network drive ing
Exec XP_cmdShell 'net use z:/delete'
Note: This method is mainly used to execute the command shell Stored Procedure xp_mongoshell in the master database. If the stored procedure is deleted or restricted, it cannot be completed. This also reminds us that, for database security, it is best to block this stored procedure.
It is also said on the network that the network drive can be backed up directly after ing, such as backup database pubs to disk = 'z: \ pubs. bak '.