You can pass the name of the column in dynamic sql:
declare @sql nvarchar (1000);
set @sql = N'update table set ' + @column_name + '= ''''';
exec sp_executesql @sql;
More Related Contents:
- Is it possible to write single query on two table which are not connected to each other?
- How to create a specific SQL Server stored procedure? [closed]
- SQL Server – Best way to get identity of inserted row?
- Should I use != or for not equal in T-SQL?
- How to update two tables in one statement in SQL Server 2005?
- Create a date from day month and year with T-SQL
- How should I pass a table name into a stored proc?
- Is the NOLOCK (Sql Server hint) bad practice?
- Creating an index on a table variable
- OR is not supported with CASE Statement in SQL Server
- Parse comma-separated string to make IN List of strings in the Where clause
- SELECT FOR UPDATE with SQL Server
- Compare DATETIME and DATE ignoring time portion
- T-SQL: Selecting Column Based on MAX(Other Column)
- How to select only the first rows for each unique value of a column?
- How to store image in SQL Server database tables column [duplicate]
- SQL “between” not inclusive
- Can I set ignore_dup_key on for a primary key?
- Unordered results in SQL
- SQL Server replace, remove all after certain character
- How to find column names for all tables in all databases in SQL Server
- Inserting rows into a table with one IDENTITY column only [duplicate]
- SQL Row_Number() function in Where Clause
- ORDER BY items must appear in the select list if SELECT DISTINCT is specified
- When using GETDATE() in many places, is it better to use a variable?
- How do I compare 2 rows from the same table (SQL Server)?
- SQL Server SELECT INTO @variable?
- Select a column if other column is null
- Date serial in SQL?
- SQL Server: +(unary) operator on non-numeric Strings