-2

What is the similar way in SQL server 2005 to stop further line code execution like we use 'return' or 'break' in c#.net

Security Hound
  • 2,577
  • 3
  • 25
  • 42
Neeraj Kumar Gupta
  • 2,157
  • 7
  • 30
  • 58
  • isn't it `return`...? – gdoron Mar 07 '13 at 11:51
  • Break is used to exit from Loop, return is to exit from sp. – Romil Kumar Jain Mar 07 '13 at 11:54
  • This require would knowlege how to write Transact-SQL code. http://msdn.microsoft.com/en-us/library/ms182587.aspx, http://msdn.microsoft.com/en-us/library/ms174998.aspx, and http://msdn.microsoft.com/en-us/library/ms181271.aspx are just three examples. – Security Hound Mar 07 '13 at 11:56
  • This useful article - [Flow control in T-SQL Scripts](http://sqlblog.com/blogs/merrill_aldrich/archive/2009/07/24/flow-control-in-t-sql-scripts.aspx) was mentioned in this answer http://stackoverflow.com/questions/2028072/t-sql-stop-or-abort-command-in-sql-server – Serg Mar 07 '13 at 12:06

2 Answers2

0

Try using raiserror, it will terminate the connection.

http://msdn.microsoft.com/en-us/library/ms178592.aspx

crazylpfan
  • 1,038
  • 7
  • 9
0

Try the raiserror command. This will terminate the connection, thereby stopping the rest of the script from running.

rheia
  • 14
  • 2