Database Name
-
Hi, Why can't I name a column with the name Name? When I say "SELECT Name..." then Name appears in blue. Why is this? Then I use [Name]. Are then any such similar words that I need appear in blue that I need to be aware of? I have a product table, and the name of the product I called Name. Is this incorrect? Should I rather call it ProductName? Regards, Brendan
-
Hi, Why can't I name a column with the name Name? When I say "SELECT Name..." then Name appears in blue. Why is this? Then I use [Name]. Are then any such similar words that I need appear in blue that I need to be aware of? I have a product table, and the name of the product I called Name. Is this incorrect? Should I rather call it ProductName? Regards, Brendan
.NET Enthusiast wrote:
Name appears in blue. Why is this?
.NET Enthusiast wrote:
Then I use [Name]
You can even name a column "select column", provided that you enclose it with those brackets. That would give you something like this;
SELECT [select column] FROM [tablename]
.NET Enthusiast wrote:
I have a product table, and the name of the product I called Name. Is this incorrect? Should I rather call it ProductName?
Both are allowed as column-names. Does a product have name, or a productname?
I are Troll :suss:
-
Hi, Why can't I name a column with the name Name? When I say "SELECT Name..." then Name appears in blue. Why is this? Then I use [Name]. Are then any such similar words that I need appear in blue that I need to be aware of? I have a product table, and the name of the product I called Name. Is this incorrect? Should I rather call it ProductName? Regards, Brendan
Check out the keyword list in Eddies post and NEVER use them. Even square bracketing them should never be allowed IMHO. Spaces in column names another horrible option that should NEVER be used. If you need to use a square bracket then there is something wrong. IIRC there used to be an app/database (I think it may have been an old ODBC driver) that refused to support [] and therefore any column requiring a [] could not be used.
Never underestimate the power of human stupidity RAH
-
Check out the keyword list in Eddies post and NEVER use them. Even square bracketing them should never be allowed IMHO. Spaces in column names another horrible option that should NEVER be used. If you need to use a square bracket then there is something wrong. IIRC there used to be an app/database (I think it may have been an old ODBC driver) that refused to support [] and therefore any column requiring a [] could not be used.
Never underestimate the power of human stupidity RAH
Thanks for your reply, but I don't see Name anywhere in that list. Description is also blue so I am assuming it is a keyword as well, but I don't see it either in that list. BTW, what does IMHO and IIRC stand for?
-
Thanks for your reply, but I don't see Name anywhere in that list. Description is also blue so I am assuming it is a keyword as well, but I don't see it either in that list. BTW, what does IMHO and IIRC stand for?
Not sure of the reason why name and description are highlighted blue but I only apply the rule to [], highlights do not affect the use of the word.
.NET Enthusiast wrote:
BTW, what does IMHO and IIRC stand for?
Are you serious, 7 years you have been a member and not run across these contractions, this site may help[^]
Never underestimate the power of human stupidity RAH
-
Not sure of the reason why name and description are highlighted blue but I only apply the rule to [], highlights do not affect the use of the word.
.NET Enthusiast wrote:
BTW, what does IMHO and IIRC stand for?
Are you serious, 7 years you have been a member and not run across these contractions, this site may help[^]
Never underestimate the power of human stupidity RAH
It blue probably because they are keywords, but why isn't Name on the keywords list, if they are not there then how do I know that it is a keyword?
-
It blue probably because they are keywords, but why isn't Name on the keywords list, if they are not there then how do I know that it is a keyword?
.NET Enthusiast wrote:
but why isn't Name on the keywords list
Because that particular example,
name
isn't a standalone keyword, but rather a modifier for an existing keyword. It's used with thecreate database
[^] command;CREATE DATABASE database_name
[ ON [PRIMARY]
[ [,...n] ]
[, [,...n] ]
]
[ LOG ON { [,...n]} ]
[ FOR LOAD | FOR ATTACH ]::=
( [ NAME = logical_file_name, ]
FILENAME = 'os_file_name'
(and more)SQL Server is also using these keywords as column-names, even in the master tables;
select *
from sysobjects
where type = 'U'
order by nameYes, it will highlight the "name" keyword, but that doesn't mean that it's an erroneous statement.
I are Troll :suss:
-
.NET Enthusiast wrote:
but why isn't Name on the keywords list
Because that particular example,
name
isn't a standalone keyword, but rather a modifier for an existing keyword. It's used with thecreate database
[^] command;CREATE DATABASE database_name
[ ON [PRIMARY]
[ [,...n] ]
[, [,...n] ]
]
[ LOG ON { [,...n]} ]
[ FOR LOAD | FOR ATTACH ]::=
( [ NAME = logical_file_name, ]
FILENAME = 'os_file_name'
(and more)SQL Server is also using these keywords as column-names, even in the master tables;
select *
from sysobjects
where type = 'U'
order by nameYes, it will highlight the "name" keyword, but that doesn't mean that it's an erroneous statement.
I are Troll :suss:
Thanks