extend variable scope

  • Hello

    I would like to make a big script which create a database

    and make some operation ( insert - update ) with some parameters

    Moreover, i would like that the script generate three job

    All is ok if i put some Go after each operation

    But i would like that some parameters like the name or the server could be change at the begining of my script.

    But with the "go" they are resetted.

    I don't know what to do

    Example :

    DECLARE @server varchar(50)

    CREATE DATABASE 'test'

    CREATE TABLE ....

    GO

    //// JOB CREAT SCRIPT

    GO

    //// JOB CREAT SCRIPT

    it doesn't work without "go"

  • inside the sp script what you wanted to do ? either to go for insert / update statement????????

    clarify....

  • Hi,

    how about ...?

    -----------------

    drop table #ok

    select 'Ok Good' ok1 into #ok

    print 'Here we go'

    select * from #ok

    go

    print 'Here we go again'

    select * from #ok

    go

    print 'Here we go at last'

    select * from #ok

    go

    --------------

    Osama

  • Thanks Osama !

    Works Perfect !

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply