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)
 check for Goto

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-09-17 : 00:05:03
Will this work with the goto function.does it take the execution to the location we specify

IF EXISTS(select emp_id from tbl_emp_details where emp_id=@emp_id)
begin
set @adv=-1
set @ert =-3
GOTO location99
end
else
begin
.........
..........
end
location99
print 'Test'

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2004-09-17 : 00:20:20
Isn't that what GOTO is for!!! The label "location99" should be followed by a colon(:).


Hemanth Gorijala
BI Architect / DBA...
Go to Top of Page

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-09-17 : 00:24:21
that means location99:
print 'Test'

should work right...correct me if Iam wrong...this goto will take the execution to that particular block...so this should be completely out of the if else condition
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-09-17 : 01:32:23
That's right.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-17 : 05:15:39
NOOOOOO..... not the goto statement.... life.... must ..... not... be .... miserable..again!!!!

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -