Home Forums SQL Server 2008 T-SQL (SS2K8) I'm trying to create a proc that will drop and create a function RE: I'm trying to create a proc that will drop and create a function

  • If you run SQLCMD via command line, you can set it to run as your user account (or the one you plan to make changes with). I believe the poster that referenced SQLCMD in this fashion, not via SSMS.

    You still have a block against that?

    Write a batch file with the following (assuming your BINN folder is in the path variable):

    sqlcmd -U MyLogin -S <ComputerName>\<InstanceName> -i <MyScript.sql> -o <MyOutput.rpt>

    create a separate line for each script. the rpt data will allow you to see the results of each step. I'm not batch champion but you could even incorporate some error logic I think to get it to stop in case you have problems with one line. You have access to google/bing/yahoobing so you can find that part out on your own.

    If you're using a different user account and it's windows based, I'd open your command line via that account (shift right click, Run as Different User).

    You could always test the technique by doing a simple select in your sql file...