If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Why does this not work (declare and go)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-05-10, 10:27
Fatbob73 Fatbob73 is offline
Registered User
 
Join Date: Sep 2008
Posts: 13
Why does this not work (declare and go)

Hi everyone,

Can someone tell me why the following those note work...

Code:
declare @testing int
go

select @testing = 1
go

select @testing
go
It complains that I must declare variable '@testing'.

But this those work...

Code:
declare @testing int
select @testing = 1
select @testing
go
In a nutshell I'm trying to write a script that is using a cursor, and it seems that to be able to use a cursor in a script I need to have 'go' after all statements.

Thanks!
Reply With Quote
  #2 (permalink)  
Old 02-05-10, 11:00
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,899
"go" is the batch terminator. It separates logical groupings of SQL statements.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On