Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy table from one db to another db without copying data 1

Status
Not open for further replies.

emilyng

Programmer
Dec 23, 2001
4
MY
Can I know how to copy a blank table (with fields) from one database (with data in the table) to another database without copying the data?
I am currently running SQL 7 (desktop version)
 
try ..

select * into db2.dbo.newtablename from db1.dbo.oldtablename
where 1=0

note that db1 and db2 are the database names such as the northwind database that ships with sql server.


 
Script the table out to a text file. open query analyzer on the machine you want to create the empty "New" table and copy in the script and run. will create the table w/ no data
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top