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 are different types of constraints?

910


How many triggers are possible per table?

1072


What are the fixed server level roles? : sql server security

1105


Determine how to use the inserted and deleted pseudo tables?

972


How does stuff differ from the replace function?

993


Why we should not use triggers?

955


List some of the rules that apply to creating and using a ‘view’

863


What is scd (slowly changing dimension)? : sql server analysis services, ssas

994


What is SQL Azure?

105


What do you mean by acid?

973


What is 3nf normalization form?

1084


What does REVERT do in SQL Server 2005?

943


Can two different columns be merged into single column? Show practically?

1043


Types of Authentications in Sql Server? How user gets authenticated through windows authentication?

1031


How to delete exactly duplicate records from a table?

1040