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
 General SQL Server Forums
 New to SQL Server Programming
 Alternative to "go"

Author  Topic 

kopfgeldjagar
Starting Member

14 Posts

Posted - 2009-04-29 : 13:32:51
I want to set up job to run nightly, but in order for it to work, I am having to use "go" several times in the query. Of course as a stored procedure, or job, "go" doesn't work. Is there an alternative that does the same thing, but will work in a stored procedure?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-29 : 13:34:59
didnt understand the necessity of so many go statements. go is used as a batch separator. can you explain what's the need for go? what are you exactly doing in job?
Go to Top of Page

kopfgeldjagar
Starting Member

14 Posts

Posted - 2009-04-29 : 13:38:59
I am creating a table with one column. Then i am having to alter the table so I can add information to new columns because the bulk import i was using would not allow me to import one column of data into a multiple column table. so I did the create, alter, "go", then update the table, "go", then append the table to the main table. I cannot update without the go, because it's trying to add to columns that haven't been created yet.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-29 : 13:42:50
if thats the case, why dont you make each one as a seperate step in job?
Go to Top of Page

kopfgeldjagar
Starting Member

14 Posts

Posted - 2009-04-29 : 13:44:43
That was my next thought, I just didn't knkow if there was a possible way around it.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-29 : 13:49:05
actually whats the purpose of creating a new table? if its for temporary use, why dont you create @ or # tables?
Go to Top of Page

kopfgeldjagar
Starting Member

14 Posts

Posted - 2009-04-29 : 13:54:29
Honestly, I didn't do an @ table or # table because I don't know enought about SQL to dig into something like that. I just got thrown into this job, and I'm trying to learn as best I can. but this way made sense to me with my lack of sql skills.
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-05-01 : 10:36:02
Time to learn.
Creating and using temporary tables and table variables is simple.

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-05-01 : 11:32:13
Time to learn? Follow the links in my sig, they are a positive BOON to beginning DBAs.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL or How to sell Used Cars
For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

kopfgeldjagar
Starting Member

14 Posts

Posted - 2009-05-02 : 07:00:37
thanks don, I'll look into them. I've used the w3schools as a reference before, but don't know the other ones.
Go to Top of Page
   

- Advertisement -