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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 inserting records accross databases
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

waynew
Starting Member

2 Posts

Posted - 09/18/2006 :  08:47:38  Show Profile  Reply with Quote
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)

Singapore
17689 Posts

Posted - 09/18/2006 :  08:53:38  Show Profile  Reply with Quote
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

India
22864 Posts

Posted - 09/18/2006 :  11:27:44  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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)

Singapore
17689 Posts

Posted - 09/18/2006 :  11:36:26  Show Profile  Reply with Quote
To be precise,

The ( and ) are call Parentheses

braces are the { and }


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22864 Posts

Posted - 09/18/2006 :  20:40:11  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Well Tan. Thanks

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000