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 beast way to write CTE in SQL Server ?
What is a matrix in ssrs?
What is difference between oltp and olap?
How to get a list of columns in a view using "sys.columns" in ms sql server?
What is the current pricing model of SQL Azure?
What is Federation Root Database?
what are the reporting service components in SSRS?
Can two different columns be merged into single column? Show practically?
Explain ranking functions?
code to create procedure for taking databse backup in sql server or i have the query for it but what it's query returns means i want to show on my jsp that the databse backup has been taken on the basis of that return value.does it returns 0 or 1.wat is the code for that
List types of tables in SQL Azure?
When would you use sql joins?
Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.
What is partition index in sql server?
please differentiate between delete and truncate?