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
When setting replication, is it possible to have a publisher as 64 bit sql server and distributor or subscribers as a 32 bit sql server?
How to create a dml trigger using create trigger statements?
What are the differences between clustered and non-clustered index?
What are magic tables in sql server?
What is the difference between clustered and a non-clustered index?
What is data source document?
Explain isolation levels that sql server supports?
What is collation?
Explain what is the purpose of sql profiler in sql server?
Tell me what is de-normalization and what are some of the examples of it?
Explain the database you used in your final year project?
Write a program to fetch first 10 records from a file?
IF more than one Site is accessing the same Database server and I want to move the DB with Minimum down time? How will you do
What is log ldf?
What is advantage data architect?