View Single Post
  #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