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 are different types of constraints?
How many triggers are possible per table?
What are the fixed server level roles? : sql server security
Determine how to use the inserted and deleted pseudo tables?
How does stuff differ from the replace function?
Why we should not use triggers?
List some of the rules that apply to creating and using a ‘view’
What is scd (slowly changing dimension)? : sql server analysis services, ssas
What is SQL Azure?
What do you mean by acid?
What is 3nf normalization form?
What does REVERT do in SQL Server 2005?
Can two different columns be merged into single column? Show practically?
Types of Authentications in Sql Server? How user gets authenticated through windows authentication?
How to delete exactly duplicate records from a table?