JMO9966
asked on
SQL Server Express 2005 - how to move data from one database to another ?
I'm using SQL Server 2005 Express and looking for the best way to transfer data from one database to another. The two databases are the same exact format.
I'm thinking there's an insert query to run with the db name..table name for the query syntax but wanted to check with the experts here.
Thanks,
JMO9966
I'm thinking there's an insert query to run with the db name..table name for the query syntax but wanted to check with the experts here.
Thanks,
JMO9966
ASKER
I didn't see this available in SQL Server Express 2005 and I'm not sure of the exact syntax to take all records in a Customer table in one db to the "same" table in a different database ??
Thanks
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, here's my attempt but I get an error:
if exists(select * from REandDv10.dbo.Customers)
Begin
delete table REandDv10.dbo.Customers
select * from REandD.dbo.customers into REandDv10.dbo.Customers
end
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'table'.
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'into'.
if exists(select * from REandDv10.dbo.Customers)
Begin
delete table REandDv10.dbo.Customers
select * from REandD.dbo.customers into REandDv10.dbo.Customers
end
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'table'.
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'into'.
Are the servers linked?
ASKER
No, but the DB's are on the same server\instance.
Thanks
Thanks
if exists(select * from [REandDv10].dbo.Customers)
Begin
delete table [REandDv10].dbo.Customers
select * from REandD.dbo.customers into [REandDv10].dbo.Customers
end
Begin
delete table [REandDv10].dbo.Customers
select * from REandD.dbo.customers into [REandDv10].dbo.Customers
end
Hi,
Isn't the syntax you are looking for drop table REandDv10.dbo.Customers ?
Regards
David
Isn't the syntax you are looking for drop table REandDv10.dbo.Customers ?
Regards
David
ASKER
Thanks I tried drop table and now I'm down to one error ??
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'into'.
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'into'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
use the insert method using the syntax you specified.