General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL: Passing A FIELD NAME As A Parameter
Hi All:
I'm trying to create a Stored Procedure where I can send parameters
of which one is a FIELD NAME of a table. Then I'd like to update
that FIELD with another parameter I'm sending (along with the FIELD
NAME) parameter. The code I tried looks like this, but it does not
work.
CREATE PROCEDURE Test_SP
@RoomNo smallint, @Field_Name char, @Assign_This char
AS
UPDATE MyTable
SET @Field_Name = @Assign_This
WHERE ROOM = @RoomNo
@Field_Name is one of the FIELD NAMES in MyTable.
I'm not getting an error message, in fact, the Query Analyzer tells
me that 1 row was affected. When I check the table, no sign of an
UPDATE - nothing's changed.
Any advice would be appreciated. TIA
MAL
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only