1

I have this query

select * 
from sysobjects
where type = "U"

and the result is exactly the same as

select * 
from sysobjects 
where type = 'U'

So I wonder what is the difference between the single quotes ' and double quotes "?

Arindam Nayak
  • 7,346
  • 4
  • 32
  • 48
Enrique Benito Casado
  • 1,914
  • 1
  • 20
  • 40
  • 2
    Simple, in SQL Server just always use single quotes for text data, and always use `[...]` to quote the *names* of SQL objects (tables, columns, etc.). You should never need (nor use, IMHO) double quotes. – RBarryYoung Jul 06 '15 at 12:26
  • 1
    If you use [`SET QUOTED_IDENTIFIER OFF`](https://msdn.microsoft.com/en-us/library/ms174393.aspx) you can use `where type = "U"` by default this will throw an error "invalid column name 'U'". MSDN: _"When SET QUOTED_IDENTIFIER is ON (default) all strings delimited by double quotation marks are interpreted as object identifiers....."_ – Tim Schmelter Jul 06 '15 at 12:55

0 Answers0