Wednesday, March 7, 2012

Change the Delimiters

Does anyone know how to change the delimiters on SQL Server 2000 SP4 Client
software?
From " " to [ ] ?
For example:
"dbo"."myTable"
to
[dbo].[mytable]
Running the Client tools on Windows XP.
John
John;
Are you asking whether there is a tool to change the double quotation mark
delimiters used in a T-SQL script to the square bracket delimiters?
I'm not aware of any native SQL Server client tool for doing this. If I were
to do it, I'd just write a script to parse the T-SQL text and do the
replacement. Now, in its most general case, the problem may not be as
straightforward as it may appear. Consider the case where you have double
quotation marks embedded in a string constant and the case where you have
double quotation marks embedded in a delimited identifier.
But your particular situation could be very straightforward without any of
the annoying cases mentioned above, and thus a simple text editor
search/replace may suffice.
Linchi
"John Smith" <john9877798@.hotmail.com> wrote in message
news:lVC4f.5075$ns3.172063@.news20.bellglobal.com.. .
> Does anyone know how to change the delimiters on SQL Server 2000 SP4
> Client software?
> From " " to [ ] ?
> For example:
> "dbo"."myTable"
> to
> [dbo].[mytable]
> Running the Client tools on Windows XP.
> John
>
|||Of course, I should add that in my previous post, by 'text editor
search/replace', I was referring to doing this manually unless you have a
text editor that supports regular expression search and replace.
If you are interested, I can email you offline a Perl script that uses
recursive descent parsing to find all the delimiters in most general case.
The script can be easily modified to do the kind of replacement you want.
Again, if you are lucky that don't need to deal with any embedded double
quotation marks, you can write a much simpler script to look for pairs of
double quotation marks and do the replacement accordingly. This can be done
with a trivial regular expression.
Linchi
"Linchi Shea" <linchi_shea@.NOSPAMml.om> wrote in message
news:%23sVEr2s0FHA.1252@.TK2MSFTNGP09.phx.gbl...
> John;
> Are you asking whether there is a tool to change the double quotation mark
> delimiters used in a T-SQL script to the square bracket delimiters?
> I'm not aware of any native SQL Server client tool for doing this. If I
> were to do it, I'd just write a script to parse the T-SQL text and do the
> replacement. Now, in its most general case, the problem may not be as
> straightforward as it may appear. Consider the case where you have double
> quotation marks embedded in a string constant and the case where you have
> double quotation marks embedded in a delimited identifier.
> But your particular situation could be very straightforward without any of
> the annoying cases mentioned above, and thus a simple text editor
> search/replace may suffice.
> Linchi
> "John Smith" <john9877798@.hotmail.com> wrote in message
> news:lVC4f.5075$ns3.172063@.news20.bellglobal.com.. .
>

No comments:

Post a Comment