how to get the current .sql file name excuting with sql script

  • Either this will be really simple or give some of you a good challenge

    I am executing .sql files from the osql utility.

    within each .sql file I want to know the name of the file executing so I can log it to a table. How can this be done?

  • Hi,

    You should use sqlcmd utility. You can pass the name of the file as variable into the script.

    Regards

    Piotr

    ...and your only reply is slàinte mhath

  • post the script

    Regards,
    [font="Verdana"]Sqlfrenzy[/font]

  • The purpose of this was to have flow control during a db upgrade.

    I wanted to log that an upgrade file had been run, if unsuccessful the upgrade process would rollback that current file and stop the upgrade.

    I went a different route which led me to do some of the work in a perl script and have more control over what ran and what needs to run

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

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