I'm trying to query the database from Visual Studio 2017 using T-SQL. The query is:
Select *
From table
Where columnname like '0%'
The error message is as follows:
Msg 207, Level 16, State 1, Line 1
Invalid column name '0%'.
The like clause is greyed in the console for some reason, it is not blue like the others.
I would like to get all records whose byte starts with 0 eg:
SELECT JobFileName
FROM JobImages
WHERE JobFileName LIKE "0%"
In SQL Server with SET QUOTED_IDENTIFIER ON
the double quotes are used to delimit identifiers (database, column and table names etc). Use single quotes to delimit strings - this works regardless of SET QUOTED_IDENTIFIER
setting:
SELECT JobFileName FROM JobImages WHERE JobFileName LIKE '0%'