Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Shrews14
Starting Member
37 Posts |
Posted - 2007-01-17 : 06:38:02
|
Hi everybody,If anybody could help me with this i would love to hear from you, at the moment this is driving me crazy.Now i have a stored procedure in SQL server 2000, which i need to pass some variables into (pretty straight forward so far!!) I am copying tables from one database to another and i what to be able to choose the spefic database i'm copying to, this is the basic's of my query!CREATE PROC sp_Copy_Facility@FacilityID int,/* Select and append Data tables */-SELECT testDB.dbo.dt_test.* INTO-******.dbo.dt_sample-FROM testDB.dbo.dt_test-WHERE testDB.dbo.dt_test.Facility_ID = @FacilityID-option (keep plan)i have also tried this:CREATE PROC sp_Copy_Facility@FacilityID int,@DBIN nvarchar(40),@DBOUT nvarchar(40)ASDECLARE @SQLString varchar(1000)DECLARE @S2 nvarchar(1000)/* Select and append Data tables */SET @SQLString = 'SELECT ' + @DBIN +'.dbo.dt_test.* INTO 'SET @SQLString = @SQLString + @DBOUT + '.dbo.dt_testSET @SQLString = @SQLString + 'FROM ' + @DBIN + ' .dbo.dt_test WHERE ' + @DBIN + '.dbo.dt_test.Facility_ID = @FacilityID option (keep plan)'please help i need to get this done and i posted this on a number of different web sites with as yet no joy!! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
Shrews14
Starting Member
37 Posts |
Posted - 2007-01-17 : 06:50:56
|
Sorry many thanks for the reply, really needed to get this done. |
 |
|
|
|
|