Page 1 of 1

stymied by reg exp

Posted: Mon Dec 01, 2003 9:47 pm
by mike_d
my forehead is bloody... appreciate any help

looking to do a reg expression find for the following:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

these sql settings may be either on or off, but its always the same 4 lines together as a group. I'm trying to find all 4 lines using a reg exp but have not spent alot of time using reg expressions and I'm going looney.

any help appreciated

mike

Posted: Mon Dec 01, 2003 9:59 pm
by s_reynisson
first try, using POSIX:

^SET QUOTED_IDENTIFIER (ON|OFF).*\n^GO.*\n^SET ANSI_NULLS (ON|OFF).*\n^GO.*\n

note it's all on one line. HTH

Posted: Mon Dec 01, 2003 10:21 pm
by mike_d
works, thanks

was trying to do something like

SET [QUOTED_IDENTIFIER|ANSI_NULLS].[a-zA-Z][:space:]


and then add on a \nGO

but that didn't fly

thanks for the help

Posted: Mon Dec 01, 2003 10:37 pm
by talleyrand
In MS Query Analyzer, Tools -> Options, Scripts Tab. Check ``Do not use a command terminator'' to remove the Gos from your scripts. I couldn't see any options for removing the other lines though.

Posted: Mon Dec 01, 2003 11:08 pm
by mike_d
using enterprise mangler to get script file for all stored procedures, doesn;t do a very good job.

trying to compare whats in sql vs whats in my source code via examdiff, but the process is less than smooth...

Posted: Mon Dec 01, 2003 11:27 pm
by talleyrand
Ah, then allow me to sing the praises of Red Gate's Sql Compare. Does just fine in showing the changes between the objects in SQL Server.