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 |
|
PuneetJain
Starting Member
3 Posts |
Posted - 2008-09-01 : 12:34:25
|
| Hi,Can anybody explain the below SP line by LineCREATE PROC GO @GO int=NULL AS SELECT @GOGOGO;GO 3GOEXECUTE('GO 1')GO 3GODROP PROC GOGO |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-01 : 13:15:41
|
| your syntax is wrong.Why not just read a book. In MSSQL press F1 to get to books online |
 |
|
|
PuneetJain
Starting Member
3 Posts |
Posted - 2008-09-01 : 13:20:38
|
quote: Originally posted by afrika your syntax is wrong.Why not just read a book. In MSSQL press F1 to get to books online
Hi,i have checked, synatx is absolutely fine.i am getting output.please run this in sql server.ThanksPuneet |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-02 : 02:57:26
|
| http://sqlblogcasts.com/blogs/madhivanan/archive/2008/08/06/another-use-of-go-command-in-sql-server-2005.aspxMadhivananFailing to plan is Planning to fail |
 |
|
|
PuneetJain
Starting Member
3 Posts |
Posted - 2008-09-02 : 11:12:50
|
this has cleared me alot, just a small questionwhats the difference between GO and GO; quote: Originally posted by madhivanan http://sqlblogcasts.com/blogs/madhivanan/archive/2008/08/06/another-use-of-go-command-in-sql-server-2005.aspxMadhivananFailing to plan is Planning to fail
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-04 : 10:04:01
|
quote: Originally posted by PuneetJain this has cleared me alot, just a small questionwhats the difference between GO and GO; quote: Originally posted by madhivanan http://sqlblogcasts.com/blogs/madhivanan/archive/2008/08/06/another-use-of-go-command-in-sql-server-2005.aspxMadhivananFailing to plan is Planning to fail
Well. As you used GO as the procedure name, to execute it for 3 times, you need to use semicolon. GO; means it is a procedure name and not batch seperator GO Run this and see the differenceCREATE PROC GO @GO int=NULL AS SELECT @GOGOGOGO 3GOEXECUTE('GO 1')GO 3GODROP PROC GOGOMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-04 : 10:11:14
|
| Also your first example can be rewritten asCREATE PROC GO @GO int=NULL AS SELECT @GOGO[GO]GO 3GOEXECUTE('GO 1')GO 3GODROP PROC GOGOMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|