Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Create table in database from select statement

Author  Topic 

eveloc
Starting Member

1 Post

Posted - 2008-02-29 : 15:27:10
I need to copy information from a table in one database to a new table in another datebase. Can this be done with a simple Select into statement?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-02-29 : 15:30:34
Insert into [Newtable]
Select * from [Database].dbo.[tablename]
Go to Top of Page

bmassey
Starting Member

22 Posts

Posted - 2008-03-03 : 20:52:00
SELECT * INTO [MyNewTable] FROM [Database].[DBO].[MyTable]

This query will create a new table that is an exact copy of the current table.
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-03-03 : 20:57:17
quote:
Originally posted by bmassey

SELECT * INTO [MyNewTable] FROM [Database].[DBO].[MyTable]

This query will create a new table that is an exact copy of the current table.



exact copy, minus child objects such as indexes, triggers, etc.


elsasoft.org
Go to Top of Page
   

- Advertisement -