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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 input parameters and stored procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-21 : 08:27:39
chris writes "I am trying to convert our existing processes to use parameterized stored procedures rather than ASP with embedded SQL. I have been able to set up input/output parameter functionality for almost everything except for instances where I need to pass in a table name as an input parameter. Is it possible to do this?

--------------------------------------------------------
CREATE PROCEDURE [Pk_Cruise_Winner]

@old_id int,
@table_name Char(20),
@entry_name Char(20),
@test int OUTPUT
AS
BEGIN
SELECT @test = count(*) FROM contest_winner WHERE contest_id = @old_id

IF @test = 0
BEGIN
select * into @table_name from @entry_name where contest_id = @old_id
END

END
---------------------------------------------------------
In this case I'm having difficulty using the variables values of @table_name and @entry_name in the last select statement. I tried declasring a local variable and setting the passed in parameter values equal to it but am still experiencing the same problem. Any suggestions?

Thanks,

Chris"
   

- Advertisement -