SQLCompare Command line - how to exclude PRINT comments

jogypjogyp Posts: 2
edited March 30, 2009 12:25PM in SQL Compare Previous Versions
Is there a way to avoid the comment lines from the SQL Compare generated script.
I am trying to create 1 db script per database for version control (I know about the Script folder and it's integration with VSS/perforce, but want versioing at the db script level not object level)

When I run the following:
"C:\Program Files\Red Gate\SQL Compare 8\SQLCompare.exe" /database1:Db1 /Server1:DB011 /exclude:user /exclude:role /options:np,ip,nc,icm /scriptfile:"C:\scripts\PipelineSchema.sql" /force
I want to get pure DB script, without lines like the one below:
PRINT N'Creating [dbo].[Catalog]'

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Jogy,

    There is no option in the command line version of SQL Compare that will eliminate all of the print statements from the script output, but you could "cook" the script by using a batch file to, first, run SQL Compare, then remove the print statements:
    sqlcompare /db1:WidgetDev /db2:WidgetLive /scriptfile:script.sql
    REM output all lines that do not contain "print"
    type script.sql | find /I /V "PRINT '" | find /I /V "PRINT N'" > cooked.sql
    
Sign In or Register to comment.