I have to assume that you are tying to implement Dynamic SQL. If so, this is how:
Declare @MyField As varchar(100)
Declare @Sql As nvarchar(1000)
Set @Sql = N'Update trixieIce.dbo.' + @MyField
+ N' Set Shipped = ''Yes'', ShippedDate = GetDate()'
Then after this you can execute it with EXEC(@Sql)
.
You should also be aware the if @MyField
is really a prarmeter that you are receiving from a client application, that it needs to be validated properly or else you'll be vulnerable to SQL Injection attacks. This is explained here: https://stackoverflow.com/a/1246848/109122