C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Tables and objects having keywords as its name


Posted Date: 29 Apr 2008    Resource Type: Articles    Category: Databases

Posted By: Aravind PK       Member Level: Gold
Rating:     Points: 5



If someone has to create/access the table/column name which is a reserved keyword, you can use the following option.

Syntax:



SET QUOTED_IDENTIFIER ON
SET QUOTED_IDENTIFIER OFF


Description:



When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers.

Example:




SET QUOTED_IDENTIFIER OFF

CREATE TABLE "select" ("identity" int IDENTITY, "order" int) — Attempt to create a table with a reserved keyword as a name will fail.

SET QUOTED_IDENTIFIER ON

CREATE TABLE "select" ("identity" int IDENTITY, "order" int)
— Now It will succeed as the QUOTED_IDENTIFIER is ON.

SELECT "identity", "order" FROM "select" ORDER BY "order"

DROP TABLE "SELECT"

SET QUOTED_IDENTIFIER OFF



--------------------------------------------------------------------------------

Note: By Default QUOTED_IDENTIFIER will be OFF, And in All stored procedures, this has to be handled properly.





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Table  .  Objects  .  Naming  .  Database  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: User Define Functions VS Stored Procedure
Previous Resource: Learn Views in Sql Server 2000
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

it support

Contact Us    Privacy Policy    Terms Of Use