Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / October 2006



Tip: Looking for answers? Try searching our database.

Insert into table from table in another data base

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JeanH - 25 Oct 2006 04:16 GMT
I know how to select data from tables in my current data base and insert that
data into another table.  What is the correct syntax to select data from data
base A, table AA into database B, table BB.  I keep getting a syntax error or
invalid object error.  I am certain this is simple but I'm doing something
wrong.  I don't want to export outside of SQL and then do an import.  I
should be able to select from and insert into.  Thanks for your help.

Jean
Paul Clement - 25 Oct 2006 15:09 GMT
¤ I know how to select data from tables in my current data base and insert that
¤ data into another table.  What is the correct syntax to select data from data
¤ base A, table AA into database B, table BB.  I keep getting a syntax error or
¤ invalid object error.  I am certain this is simple but I'm doing something
¤ wrong.  I don't want to export outside of SQL and then do an import.  I
¤ should be able to select from and insert into.  Thanks for your help.

The syntax required will vary depending upon the type of database you are working with. You may want
to post a bit more information and some code.

Paul
~~~~
Microsoft MVP (Visual Basic)
JeanH - 25 Oct 2006 16:09 GMT
Hi Paul,
Thanks for your inquiry.

I was trying to do the following:

insert into [database].table1( field1, field2 )
select fieldA, fieldB from [database].tableX

Sincerely,

Jean Holland

> ¤ I know how to select data from tables in my current data base and insert that
> ¤ data into another table.  What is the correct syntax to select data from data
[quoted text clipped - 9 lines]
> ~~~~
> Microsoft MVP (Visual Basic)
Jan Hyde - 25 Oct 2006 16:41 GMT
JeanH <JeanH@discussions.microsoft.com>'s wild thoughts were
released on Wed, 25 Oct 2006 08:09:01 -0700 bearing the
following fruit:

>Hi Paul,
>Thanks for your inquiry.
[quoted text clipped - 5 lines]
>
>Sincerely,

You still didn't say what database your using and this is
probably the single most important piece of information we
need as Paul said SQL syntax varies from database to
database.

J

>>Jean Holland
>
[quoted text clipped - 11 lines]
>> ~~~~
>> Microsoft MVP (Visual Basic)

Jan Hyde (VB MVP)

Signature

Why don't boxers have sex before a fight?

Because they don't fancy each other.

JeanH - 25 Oct 2006 20:58 GMT
For this application I am using MSDE but sometimes I use SQL Server 2000 Full
Version.

Jean

> JeanH <JeanH@discussions.microsoft.com>'s wild thoughts were
> released on Wed, 25 Oct 2006 08:09:01 -0700 bearing the
[quoted text clipped - 34 lines]
>
> Jan Hyde (VB MVP)
Paul Clement - 26 Oct 2006 20:43 GMT
¤ Hi Paul,
¤ Thanks for your inquiry.
¤
¤ I was trying to do the following:
¤
¤ insert into [database].table1( field1, field2 )
¤ select fieldA, fieldB from [database].tableX
¤

See if the following helps:

http://www.databasejournal.com/features/mssql/article.php/3507171

Paul
~~~~
Microsoft MVP (Visual Basic)
JeanH - 26 Oct 2006 22:22 GMT
Hi Paul,

By looking at the syntax I see that I was not putting the table owner after
the database name. That's why I was getting the error.  So [database].table
is not correct but when I changed it to [database].dbo.table it worked fine.

Thanks,

Jean

> ¤ Hi Paul,
> ¤ Thanks for your inquiry.
[quoted text clipped - 12 lines]
> ~~~~
> Microsoft MVP (Visual Basic)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.