How to resolve this"Invalid Column Name" error?
Trying to run a simple UPDATE query as follows:
UPDATE [TILL].[dbo].[appParameters] SET [TILL].[dbo].[appParameters].[ParameterValue] = "1" WHERE [TILL].[dbo].[appParameters].[ParameterName] = "StaffTablesRefreshed"
If the field [ParameterName] is the value "StaffTablesRefreshed", then set the value of [ParameterValue] to "1". When executed, SQL Server throws an error: Invalid column name 'StaffTablesRefreshed' Both [ParameterName] and [ParameterValue] are nvarchar(255). Am I missing something obvious here?
You can resolve this error just replace the double quotes with single quotes. By default SQL Server treats double quotes as a delimiter for identifiers (for instance column names), and that is what happens for your query. Strings are enclosed in single quotes. As for the number (1), you probably want to just remove the double quotes (assuming the data type in the table is numeric, if it is a string, then use single quotes here too). There is a setting to change how SQL server handle double quotes: SET QUOTED_IDENTIFIER, but apparently you are using the default setting, meaning go by my above recommendations.