Page 1 of 1

missing quotes around reserved words

Posted: Mon 19 Dec 2011 18:22
by mindplay
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.

Posted: Fri 23 Dec 2011 08:12
by Shalex
Please refer to http://msdn.microsoft.com/en-us/library/ms189822.aspx: there is no "Type" in the SQL Server reserved keywords list.

Posted: Fri 23 Dec 2011 14:56
by mindplay
You're right - my mistake.

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