March 17, 2010 at 2:55 am
Is there a way of querying a list of reserved words in SQL Server.
What I am trying to do is write a test that searches for objects that have a reserved word name.
Yes, I know that Management Studio lights up the words in colour if something typed in is a reserved word but I'm doing the policing not the programming. I was not happy to find a table called Table or a field called SELECT.
March 17, 2010 at 12:37 pm
assuming SS2K5 I'd use a table holding all reserved words I'd like to chek (e.g. from this web site: https://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.etools.ejbbatchdeploy.doc/topics/rsqlMSSQLSERVER_2005.html
)
and join that to sys.syscolumns.name and sys.sysobjects.
March 17, 2010 at 12:46 pm
lmu92 (3/17/2010)
assuming SS2K5 I'd use a table holding all reserved words I'd like to chek (e.g. from this web site: https://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.etools.ejbbatchdeploy.doc/topics/rsqlMSSQLSERVER_2005.html)
and join that to sys.syscolumns.name and sys.sysobjects.
That's about the best way to do it.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
March 17, 2010 at 11:41 pm
There's a list of reserved words in Books Online and it's not limited to just T-SQL.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 18, 2010 at 5:52 am
Thanks,
The IBM list gave a good jump start. It's just a shame that there isn't an inbuilt function that returns a table of these words.
It would be great to be able to put a condition in the SQL2008 policies to trap this.
March 18, 2010 at 9:23 am
David.Poole (3/18/2010)
Thanks,The IBM list gave a good jump start. It's just a shame that there isn't an inbuilt function that returns a table of these words.
It would be great to be able to put a condition in the SQL2008 policies to trap this.
Agreed, that would be a nice feature. Maybe in a future release.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply