June 12, 2010 at 9:46 pm
What are you guys & gals thoughst about someone using a DATA TYPE like TEXT or INT as the anme in a atbles column like this?
CREATE TABLE ( Text VARCHAR(255),
INT TINYINT,
and so on....
I just ran into this on our DB during a program update and I coudln'tbelieve it. More suprising is I can't find where in SQL Serverthis is a problem, at least with these 2 and I woiuld have thought TEXT would be a resreved keyword since its a data type.
This has to at least be considered bad practice, right?
Kindest Regards,
Just say No to Facebook!June 13, 2010 at 1:05 am
I have to admit that I was surprised that we can name a column with the data types’ names with no problems at all. Although this can be done, I defiantly think that this should be avoided. Column name should be descriptive. The name should imply what it is storing, so I’ll always have names such as Grade, DateOfBirth, FirstName etc’. Names like Text, Int, DateTime are meaningless and any code that uses those names will be very hard to maintain.
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
June 14, 2010 at 7:30 am
In most places you'll need to bracket key words to use them within structures like that. Can you do it? Yes. Should you do it? I'd say no, but at the same time, with the brackets in place, it's not the end of the world. However, it is likely to cause issues down the line. Minor errors almost definitely will occur. So, as a best practice, I'd strongly recommend against it.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply