Reply to topic
Making a copy of a MS SQL table
Candywrapper


Joined: 30 Jun 2005
Posts: 4
Location: San Clemente, CA
Reply with quote
Here is an extremely simple script to make a copy of a MS SQL table. I had need to experiment with some Cold Fusion code in developing a project and was afraid I would mess up the original database table when I ran the script so I needed a backup of the table before running the script. Kyle, at HostMySite, suggested that I post the script as others might have the same need. Here it is. I hope it helps others.

<!---
***************************************************
Project Name: Copy SQL Table
Initial Creation Date: 5/22/2007
Author: Warren Hoffnung
GGTE warren@ggte.com
Purpose: This is a handy way to create a backup or a copy of a SQL Table.
Application Note: There is no need to create the new table prior to
running the script. The new table will be automatically
created by SQL Server. You do not have to be running ColdFusion.
You can simply use the 3 lines of the query in Enterprise Manager
or however you access your SQL Database.
It is probably obvious but just in case, do not type the [ ] when you run the script. Simply substitute your own information.

<B>REVISION HISTORY</B>
Date:

***************************************************
--->


<cfquery name="copytable" datasource="#DS#" username="#User#" password="#PW#">
SELECT *
INTO [your_new_table_name]
FROM [the_table_you_want_to_copy]
</cfquery>
Making a copy of a MS SQL table
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic