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.
| Author |
Topic |
|
ajthepoolman
Constraint Violating Yak Guru
384 Posts |
Posted - 2011-06-17 : 16:41:33
|
In a query that I am looking into, the developers have placed the following in what appear to be random spots throughout the stored procedure:label1: The stored proc doesn't seem to mind them being there. There isn't anything that comes back in the Messages tab when I execute the proc. I don't see what they do. They are blue in color which leads me to believe that they are somehow keywords in SQL.Hey, it compiles. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-06-17 : 16:45:50
|
| They're used with the GOTO statement: GOTO label1If there are a lot of them that's a sign of poor programming. |
 |
|
|
ajthepoolman
Constraint Violating Yak Guru
384 Posts |
Posted - 2011-06-17 : 16:53:09
|
| So if there are no GOTO statements, then that is really poor programming huh!?Hey, it compiles. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-06-17 : 16:54:43
|
| Nope, but there's no real reason to have them if they're not using GOTO. |
 |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2011-06-17 : 18:26:43
|
| Are they all the same name, or does each one have a different name?I am assuming each one is different, but who knows. Also, are they all like 'label1:', 'label2:', etc... or do they have descriptive names?I have seen some programmers use labels like this to break up the sections of code. Not necessarily good or bad, as long as you don't have a lot of GOTO statements creating various execution paths.Jeff |
 |
|
|
|
|
|