How can I create a table from another table without copying any values from the old table?
Answer Posted / mohammadali.info
CREATE TABLE new_table
AS (SELECT * FROM old_table WHERE 1=2);
For example:
CREATE TABLE suppliers
AS (SELECT * FROM companies WHERE 1=2);
This would create a new table called suppliers that included all columns from the companies table, but no data from the companies table.
Is This Answer Correct ? | 7 Yes | 3 No |
Post New Answer View All Answers
Explain indexes disadvantages?
How column data types are determined in a view?
Where to find ntwdblib.dll version 2000.80.194.0?
What are the differences between sql server and mysql.
How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?
What are .mdf files?
Is it ok to shrink transaction log?
Do you know how to make remote connection in database?
What are the operating modes in which database mirroring runs?
Why main is user defined function?
What is the difference between lock, block and deadlock? : sql server database administration
How to query multiple tables jointly?
What is the cartesian product of table?
What are the types of sql server?
How can you find out which stored procedures are recompiling?