String strSQL="UPDATE dbo.Employees SET Level='" + strLevel+"' WHERE Title='"+strTitle+"'" In application, some programmers like directly using double quotes and single quotes to compose a T-SQL statement before submit it to SQL Server. If your literal string contain single quotes, using double quotes to enclose the string should be more convenient.ĭouble Quotes and Single Quote in Application When QUOTED_IDENTIFIER is turned off, you cannot use double quotes to enclose identifiers for object names. SELECT * FROM dbo.Employees WHERE Title="Mr." However, if you want to use double quotes to enclose literal strings like a single quote, you can disable QUOTED_IDENTIFER. It can only be used for enclosing identifiers, for example, SELECT * FROM "dbo"."Employees". By default QUOTED_IDENTIFIER is enabled and you cannot use double quotes to enclose literal strings in this case. In SQL Server 2000, 20, double quotes and single quotes are both allowed but double quotes have different usage depending on the quote setting QUOTED_IDENTIFIER. What are the differences with single quote?ĭouble Quotes and Single Quotes in SQL Server I often see some T-SQL using double quotes to enclose string or table names.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |