Wednesday, 29 May 2013

SET QUOTED_IDENTIFIER in sql server

SET QUOTED_IDENTIFIER in sql server

   Hi,
              In this article we will see a use of SET QUOTED_IDENTIFIER options in sql server. This options specifies  the setting for usage of double quotation. When this is on, double quotation mark is used as part of the SQL Server identifier (object name). This can be useful in situations in which identifiers are also SQL Server reserved words.
For example ::

1) Try to create a table with name "select"


                                CREATE TABLE  SELECT (id INT)


2) Try to create a proc with name "delete"


                                CREATE PROCEDURE DELETE
                                AS
                                BEGIN
                                      PRINT'Impossible'
                                END


*)Now check the effect of "SET QUOTED_IDENTIFIER On" in sql server

1) we will again try to create table with name select by using below statement.


                            SET QUOTED_IDENTIFIER On
                            CREATE TABLE "SELECT"(id INT)

2)we will also try to create procedure with name delete by using below statement.


                            SET QUOTED_IDENTIFIER On
                            CREATE PROCEDURE "DELETE"
                            AS 
                            BEGIN
                                    PRINT  'possible'
                           END

1 comment:

8451831077