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
 Site Related Forums
 Article Discussion
 inserting records accross databases

Author  Topic 

waynew
Starting Member

2 Posts

Posted - 2006-09-18 : 08:47:38
I am trying to consolidate records from multiple tables in different databases to a master database. All tables will have the same structure. I tried the command:
insert CrystalReports.dbo.APVEN(VENDORID, AUDTDATE, AUDTTIME, AUDTUSER, AUDTORG, SHORTNAME, IDGRP, SWACTV, DATEINAC, DATELASTMN, SWHOLD, DATESTART, IDPPNT, VENDNAME)
select (VENDORID, AUDTDATE, AUDTTIME, AUDTUSER, AUDTORG, SHORTNAME, IDGRP, SWACTV, DATEINAC, DATELASTMN, SWHOLD, DATESTART, IDPPNT, VENDNAME)
from Saminc.dbo.APVEN
and I keep getting errors.

Is there a simple way to copy all records using an insert command?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-18 : 08:53:38
remove the ( and ) in SELECT

insert CrystalReports.dbo.APVEN(VENDORID, AUDTDATE, AUDTTIME, AUDTUSER, AUDTORG, SHORTNAME, IDGRP, SWACTV, DATEINAC, DATELASTMN, SWHOLD, DATESTART, IDPPNT, VENDNAME)
select VENDORID, AUDTDATE, AUDTTIME, AUDTUSER, AUDTORG, SHORTNAME, IDGRP, SWACTV, DATEINAC, DATELASTMN, SWHOLD, DATESTART, IDPPNT, VENDNAME
from Saminc.dbo.APVEN




KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-18 : 11:27:44
When selecting data, you dont need to have columns withing braces

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-18 : 11:36:26
To be precise,

The ( and ) are call Parentheses

braces are the { and }


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-09-18 : 20:40:11
Well Tan. Thanks

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -