I want to generate backup of specific table in SQL Server 2014 through a SQL Query.
I can generate it manually but I want to generate it through a SQL Query. Can any body help me to do that?
I want to generate backup of specific table in SQL Server 2014 through a SQL Query.
I can generate it manually but I want to generate it through a SQL Query. Can any body help me to do that?
You've not provided much information as to what exactly you require with this, but you can do a simple SELECT * INTO
, which will create a table based off the table you reference in the SELECT *
command.
Example:
Say you have a table called Accounts
, and you want to create a backup of this table, calling it AccountsBackup
, you can do this:
SELECT *
INTO AccountsBackup
FROM Accounts
Note, this will create a table with the same schema in the same database as the Accounts
table and insert all records from the source table in to it. This will not copy primary keys or constraints, it will be a simple dump of the source table.
Also, this table shouldn't exist before you run the above SQL, so if you plan on doing this more than once, either check if it exists first or generate unique names each time.