missing quotes around reserved words

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

missing quotes around reserved words

Post by mindplay » Mon 19 Dec 2011 18:22

The database scripts generated by ED (for SQL server) are not being quoted correctly - for example:

Code: Select all

-- 
-- Altering a table dbo.Task 
-- 
ALTER TABLE dbo.Task
   ALTER COLUMN Type VARCHAR(MAX) NOT NULL
GO
The word "Type" is a reserved word and must be quoted as "[Type]" on SQL Server.

I personally would recommend consistently quoting all column and table names in generated SQL scripts to avoid this issue - also makes the scripts more legible.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 23 Dec 2011 08:12

Please refer to http://msdn.microsoft.com/en-us/library/ms189822.aspx: there is no "Type" in the SQL Server reserved keywords list.

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Fri 23 Dec 2011 14:56

You're right - my mistake.

There is "CREATE TYPE", so maybe that's why it highlights as a keyword in text editors...

Post Reply