I’m working on some legacy SQL and the author delimited every column name and data type declaration. See the following:
CREATE TABLE SomeTable (
[SomeDate] [datetime] NOT NULL,
[SomeInt] [int] NOT NULL,
[SomeString] [nvarchar] NOT NULL
) ON [PRIMARY]
GO
Is this considered a best-practice when writing T-SQL for SQL Server? Since I’m now maintaining this code, should I continue the practice?
I personally would only write that if you’re using reserved keywords as column/table names, which you shouldn’t be anyway. Personally I think otherwise, it makes the SQL code less ‘clean’ and a bit more difficult to read.
This style is usually what is generated by SQL tools, as it guarantees that there won’t be any issues with reserved word conflicts.