Greetings All!
Wondering if anyone knows if it is possible to pass a database name into a Stored Proc and assign it to a variable to be used in a SQL statement. I am writing a Stored Proc that needs to reference a group of databases that are the same structurally but contain different data. The specific database being accessed with depend on what is being requested by a user through a ColdFusion form. The following is an example of what I am trying to do:
CREATE PROCEDURE dbo.vspTestProc
(
@CurrentDB (Data Type?)
)
AS
INSERT INTO TempTable (Col1,Col2,Col3)
SELECT CurrentTable.Col1, CurrentTable.Col2, CurrentTable.Col3
FROM @CurrentDB.Table1 AS CurrentTable
Any suggestions will be greatly appreciated
Regards,
Nathan C. Hoialmen
President
Encephalon Business Solutions, LLC
Wondering if anyone knows if it is possible to pass a database name into a Stored Proc and assign it to a variable to be used in a SQL statement. I am writing a Stored Proc that needs to reference a group of databases that are the same structurally but contain different data. The specific database being accessed with depend on what is being requested by a user through a ColdFusion form. The following is an example of what I am trying to do:
CREATE PROCEDURE dbo.vspTestProc
(
@CurrentDB (Data Type?)
)
AS
INSERT INTO TempTable (Col1,Col2,Col3)
SELECT CurrentTable.Col1, CurrentTable.Col2, CurrentTable.Col3
FROM @CurrentDB.Table1 AS CurrentTable
Any suggestions will be greatly appreciated
Regards,
Nathan C. Hoialmen
President
Encephalon Business Solutions, LLC