Dynamic SQL
From: Shamim (shamim.abdul_at_railamerica.com)
Date: 05/23/03
- Next message: Billie Edson: "Re: can no longer add new logins"
- Previous message: Andy Sjostrom: "Re: Login failed for user"
- Next in thread: Steve Thompson: "Re: Dynamic SQL"
- Reply: Steve Thompson: "Re: Dynamic SQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 23 May 2003 09:23:36 -0500
SQL SERVER 2K
Got a server with 15 databases, need to load data from 15 databases to a
common data-wearhouse database in the same server.
Developed a SP with INSERT ,UPDATE statements to load data.
I want to dynamically change database name in my SQL statements.
I created a table 'dbname' which stores all database name.
Inside my SP, using a CURSOR ,dynamically change the database name.
My issue is , I have lengthy INSERT / UPDATE statements, how to make it
work using 'EXEC' statement ??
For Example EXEC (' insert into xxxx
select 50 columns from ' + @dbname +
'.dbo.yyyyy')
Any good approach to use EXEC for long SQL statements ??
Thanks
Shamim
- Next message: Billie Edson: "Re: can no longer add new logins"
- Previous message: Andy Sjostrom: "Re: Login failed for user"
- Next in thread: Steve Thompson: "Re: Dynamic SQL"
- Reply: Steve Thompson: "Re: Dynamic SQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|