Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 GO statement in SQL Job

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2005-01-05 : 17:06:06
I have a SQL job which execute the below script

Alter table A ADD colum B varchar(10)
GO
Update A
set B = 'Test'


Is ther any way I can use 'GO' statement in the SQL Job?. Since 'GO' statment is not a T-SQL statment, it keep giving me a syntax error.



AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-01-05 : 18:06:16
GO is just a special word that Query Analyzer recognizes as a separator between groups of commands. Just delete the GO and put the two commands in different Job Steps and you should be fine.

---------------------------------------------------------------------------------
Infoneering: Information Technology solutions engineered to professional standards.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-01-05 : 23:58:17
If you want them in one "step" maybe ";" will work instead of "GO" ?

Kristen
Go to Top of Page

jung1975
Aged Yak Warrior

503 Posts

Posted - 2005-01-06 : 16:02:05
sorry, but ";" didn't work.




Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-06 : 16:35:28
Why would you want to make this in to a job anyway.

It can only run once..unless you add a drop column before that.

And that wouldn't make sense.

Is there a better example?



Brett

8-)
Go to Top of Page
   

- Advertisement -