Why it’s
select * from [User]
rather than:
select * from User
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Another reason : Square brackets mainly used to identify the column names with spaces or special characters in them. e.g.
[movie name]However in that case, you must use brackets to refer to these columns then.So in order to give the universal idea to be able to use single name and multiple names for fields, the [] are always shown in the syntaxes.
This could be the same reason behind applying [] to table name as well.
According to this post: “” and [] are delimeter identifiers. This is necessary if the column name/table name is a reserved keyword or contains special characters such as a space or hyphen.
And this reference says
Useris a reserved keyword …You may want to try out with table name like
myuser, to confirm if this nature still persists.One other thing, if your book is an old version, where [] were optional in Visual studio for single table names. However it may have changed to the earlier versions of Visual stduio where you must use square brackets at times independent of table name being single name, two names, reserved word, name with special characters… 🙂