dbTalk Databases Forums  

Variable database.table access issue

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Variable database.table access issue in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
whornak
 
Posts: n/a

Default Variable database.table access issue - 11-17-2004 , 09:05 AM






I have a table that I need to reference that is not always in the same
database as all other tables. I have available to me the database name the
table exists in but can't get my sql statement to accept an input parameter
containing the database that I need to join to.

Does anyone know how to structure a sql statement so one of the joined
tables is within a variable database?

Reply With Quote
  #2  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: Variable database.table access issue - 11-17-2004 , 09:09 AM






Sounds like you need to use dynamic sql. See here for more details:
http://www.sommarskog.se/dynamic_sql.html

--
Andrew J. Kelly SQL MVP


"whornak" <whornak (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have a table that I need to reference that is not always in the same
database as all other tables. I have available to me the database name
the
table exists in but can't get my sql statement to accept an input
parameter
containing the database that I need to join to.

Does anyone know how to structure a sql statement so one of the joined
tables is within a variable database?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.