Hi,
This will probably seem like a newbie question to the pros around here, but its stumping me. How do you use a variable in place of a field or table name in Select and Update statements?
In my example I want to create a Stored Procedure and pass a field name to it and have it run an update statement.
EXAMPLE:
Create Proc Updating1
@Fieldname as varchar(30)
AS
BEGIN
UPDATE myTable1 SET @Fieldname=10
Do I have to enclose @Fieldname in brackets or something?
Thanks in advance for any help.
This will probably seem like a newbie question to the pros around here, but its stumping me. How do you use a variable in place of a field or table name in Select and Update statements?
In my example I want to create a Stored Procedure and pass a field name to it and have it run an update statement.
EXAMPLE:
Create Proc Updating1
@Fieldname as varchar(30)
AS
BEGIN
UPDATE myTable1 SET @Fieldname=10
Do I have to enclose @Fieldname in brackets or something?
Thanks in advance for any help.