G
Guest
Trying to wrap my brain around Regex for the first time...
I need to be able to replace Sql @NamedParameters with "?" for compliance
with an extremely lame 3rd party Odbc driver. I know that this should be
fairly straighforward in Regex but I'm not a Regex guru. Does anybody know
how to turn this {not real Sql but demonstrates my issue}:
SELECT * FROM Customers WHERE State=@State AND LastName LIKE @LastName
into this
SELECT * FROM Customers WHERE State=? AND LastName LIKE ?
using Regex? And for extra credit is it possible to have the search be
intelligent enough to NOT replace an @Xxx occurrence if it occurs within
quoted text?
Thanx in advance for any advice...
--Richard
I need to be able to replace Sql @NamedParameters with "?" for compliance
with an extremely lame 3rd party Odbc driver. I know that this should be
fairly straighforward in Regex but I'm not a Regex guru. Does anybody know
how to turn this {not real Sql but demonstrates my issue}:
SELECT * FROM Customers WHERE State=@State AND LastName LIKE @LastName
into this
SELECT * FROM Customers WHERE State=? AND LastName LIKE ?
using Regex? And for extra credit is it possible to have the search be
intelligent enough to NOT replace an @Xxx occurrence if it occurs within
quoted text?
Thanx in advance for any advice...
--Richard