Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is policy based management (pbm)? : sql server database administration

1029


What are different types of constraints?

968


What happens if ntwdblib.dll is missing on your machine?

1187


Are all views updatable ?

1198


Due to some maintenance being done, the sql server on a failover cluster needs to be brought down. How do you bring the sql server down?

1380


How to set a database state to offline in ms sql server?

1101


Do you know what are acid properties of transaction?

1005


What is an example of a primary key?

1037


Do you know how to implement service broker?

965


Why would you call update statistics?

1071


What do you mean by an execution plan?

1186


Can truncate be rolled back?

988


How to include date and time values in sql statements?

1139


Explain microsoft sql server functions?

1175


How do I view a script in sql server?

1082