July 30, 2020 at 2:39 pm
I've been coming to this site for years. I've never registered, and I almost always find the answer to my questions. But I am stumped. I freely accept your LRN2SRCH responses if this has been asked and answered a dozen times already...
Trying to get less behind the curve, I'm bringing up a database running on compatibility 100 to 140. I started modifying some problem procedures and decided to use quoted identifiers on names, because the schema I have inherited has some fantastic column names like 'user' and 'timestamp'.
However, when I script them back out in SSMS, my quoted identifiers have been replace with the square brackets. I cannot find anywhere in the options to change this behavior. Please send help. Thank you.
July 30, 2020 at 3:21 pm
It's the nature of the beast and, to be honest, the brackets are the preferred method (in SQL Server, anyway) for using reserved words and object names that contain spaces, dashes, etc. The brackets are the same thing as quoted identifiers and is actually the default used by the QUOTENAME() function.
And, no... no "LRN2SRCH responses" for this one. This isn't an easy find unless you already know the answer, which would mean you know what to search for. Heh... like I tell people, how can you find the correct spelling of a word in a dictionary if you have no clue as to how the word is spelled?
--Jeff Moden
Change is inevitable... Change for the better is not.
July 30, 2020 at 3:55 pm
There is no option to disallow this. There is a feedback item to add this, but so far. MS has not implemented this option.
July 30, 2020 at 3:59 pm
Thanks for the quick answers. I guess I'll stick with the square brackets. Glad I didn't change too many procedures first!
July 30, 2020 at 4:23 pm
Andy Mallon has a procedure to remove them.
https://am2.co/2018/07/removing-square-brackets-from-generated-ssms-scripts/
July 30, 2020 at 5:06 pm
Andy Mallon has a procedure to remove them.
https://am2.co/2018/07/removing-square-brackets-from-generated-ssms-scripts/
It's no longer needed if you have the later versions of SSMS. It's actually a setting now and, IIRC, it also leaves essential brackets in place..
My apologies. This is wrong. It's only for the click'n'drag functionality of the Object Explorer
--Jeff Moden
Change is inevitable... Change for the better is not.
July 30, 2020 at 5:47 pm
I know it's an option in SQL Prompt... but... I do not think the inclusion/exclusion of quoted identifiers is a configurable scripting setting in SSMS.
July 30, 2020 at 6:26 pm
I know it's an option in SQL Prompt... but... I do not think the inclusion/exclusion of quoted identifiers is a configurable scripting setting in SSMS.
Ah... my apologies. It's only for the click'n'drag functionality in the Object Explorer. I fixed my prior post on it, as well.,
Ok... more coffee.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply