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)
 parameter passing in script

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-18 : 07:49:03
vaneza writes "How can i create a script that would pass a value. I wanted to create a dynamic script that would anable the user to enter the table name and the data field. I use EXEC command to execute the script. But the error msg appear " Invalid column name"

Pls.. help.. I need a solution ASAP.

Here is my sample script.

CREATE PROCEDURE SAMPLE @TableName nvarchar(255),
@Field nvarchar(255)

AS

BEGIN
EXEC('SELECT * FROM '+@TableName +' WHERE RECORD_ID = '+@Field )
END


Thanks.

Vaneza"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-18 : 07:53:15
There is no column named RECORD_ID for that table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -