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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying one table to another database

Status
Not open for further replies.

mozingod

MIS
Jul 9, 2002
227
US
Hi, I have two databases (one's a restored backeup). They're named mill_info and mill_info_copy. Each has a table named Interchange. What would be the SQL code to copy everything from mill_info_copy's Interchange table to mill_info's? I tried the following with no luck:

"INSERT INTO mill_info.dbo.Interchange SELECT * FROM mill_info_copy.dbo.Interchange"

I have to do this from an ASP page too. Thanks for any help. Darrell Mozingo
 
Don't see much wrong with that statement, assuming the actual table exists. What error are you getting? --James
 
Microsoft OLE DB Provider for SQL Server error '80040e37'

Invalid object name 'mill_info.dbo.Interchnge'. Darrell Mozingo
 
Whoops, that was quite blind of me. After actually spelling the table name right :) I get this error:

Microsoft OLE DB Provider for SQL Server error '80040e14'

An explicit value for the identity column in table 'mill_info.dbo.Interchange' can only be specified when a column list is used and IDENTITY_INSERT is ON. Darrell Mozingo
 
Ah, got it. Just changed it from an identity column, then back into one after the copy :) Darrell Mozingo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top