July 12, 2008 at 5:07 am
[] are not supposed to change the meaning of a statement. They're supposed to just be delimiters.
But [] do change the meaning of SQL Statements.
In the below example, "left outer join" returns 19 but "
join" returns 0. The [] change the meaning of the SQL where "left outer join" defines a join option but "
join" specifies that the alias of the table on the previous line should be "left outer" and the an inner join.
select count(*)
fromdbo.sysobjects
left outer joindbo.sysfiles
on maxsize = id
wherextype = 's'
select count(*)
fromdbo.sysobjects
join dbo.sysfiles
on maxsize = id
wherextype = 's'
SQL = Scarcely Qualifies as a Language
July 12, 2008 at 5:12 am
the [] are commonly used to negate SQL keywords.
say you had a column in a table called object_id, to reference it as a column and not a keyword is like so [object_id]
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
July 14, 2008 at 7:33 am
balbirsinghsodhi (7/11/2008)
That is not a temp table. It's a real table with # in the begning.
What database does it say it exists in?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 14, 2008 at 7:41 am
Carl Federl (7/12/2008)
[] are not supposed to change the meaning of a statement. They're supposed to just be delimiters.
But [] do change the meaning of SQL Statements.
Perhaps I should have said "[] are not supposed to change the meaning of a name" Since they are delimiters, I would expect that [table1] and table1 refer to the same object (assuming it's not a SQL keyword)
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply