Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-19 : 16:10:28
|
AlanP writes "I need to make a copy of a table using TSQL. I know it can be done using DTS or "Generate Script" in the EM which means there must be built-in procedures for scripting a table structure. I cannot use these manual methods as the table structure will vary with time so I need to do it dynamically.
The only solution I can see is to extract the column names and Datatypes from the Information Schema, construct a string and execute it to create the table whereafter it can be populated.
I need a "copy_existing_table_to_new_table" procedure and surely there must be a standard procedure in SQL Server to do this?
Further info: I need to apply a mask to 40-plus columns to find which rows match my search criteria. To avoid a complex SELECT statement (which would exceed the 8000 character limit anyway), I create a temporary table and then cursor through each column, deleting the rows which do not meet the SELECT criteria. The rows remaining after doing each column are then my desired result.
Sql 2000 on Windows 2000 Server" |
|
|
|
|
|