• bartvdc (12/11/2012)


    I'm yet another user of this great procedure. Lowell, thanks for the work and sharing.

    I'm using it to (re)create tables from within a java app. I just have some issue with the GO statement , it always fails just after it.

    As a workaround I changed the procedure so that each GO is replaced by a semicolon ';' . That works for indexes but not for triggers('must be the first statement in a query batch').

    I guess the GO statement needs the 'newline' & 'carriage returns' before & after. Apparently the CHAR(10) & CHAR(13) are not recognized as such.

    Is there any user that solved such a problem ?

    Bart

    bartvdc

    good point Bart! everyone using anything other than SQL Server Management Studio would have the same problem;

    the GO is a batch separator for SSMS, and not an actual SQL Command; so you are doing it right by replacing it with semi colons., for sure.

    Glad this is helping you out!

    are you using the latest, which can also script any object or temp table?

    Latest sp_GetDDL_Latest.txt which returns a varchar(max) string

    Latest sp_GetDDLa_Latest.txt which returns a recordset

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!