Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql server management studio invalid column name where clause

Tags:

sql

ssms

I am writing a query to filter a table by a certain field. However, the filter I am using is being evaluated as a column for some unknown reason.

i.e.

SELECT prn FROM CompanyPack WHERE prn = "212"

In this query, SSMS 2012 throws an error in which it is telling me that "212" is an invalid column name, but it is not a column at all.

prn is a nvarchar(50).

Any advice?

like image 287
Shompsey Avatar asked Jan 23 '14 17:01

Shompsey


1 Answers

Use single quotes '' not double quotes ". Like so

SELECT prn FROM CompanyPack WHERE prn = '212'
like image 112
Shiva Avatar answered Sep 27 '22 21:09

Shiva