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
What is the difference between functions and stored procedures?
How do I uninstall sql server 2014?
What is the difference between lock, block and deadlock? : sql server database administration
What is usually the first word in a sql query?
Do you know what are the restrictions applicable while creating views? : SQL Server Architecture
What is transaction server implicit?
What is order of B+tree?
What are distributed partitioned views?
What is efficiency data?
What is the name of the Database which IBM mainframe uses?
Explain an automatic checkpoint
How do use Having,Group by,Group function in SQL?
What does the not null constraint do?
Explain having clause?
What is collation sensitivity?