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 |
|
rkuhnjr
Starting Member
2 Posts |
Posted - 2008-11-04 : 15:21:25
|
| I created a job with about 5 steps that process data and uses ftp to send data to our customer. However they want to be able to shut off the job which runs nightly sometimes.I'm going to build a table to house date ranges that will allow our suctomer to input date ranges using a UI that will cause the job to not process.So my question is after I do a select with GetDate() between such AND such How can i set it to cause a job step to fail if @@rowcount > 1 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-11-04 : 15:29:46
|
| Look at RAISEERRORhttp://msdn.microsoft.com/en-us/library/ms178592(SQL.90).aspx |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-04 : 15:36:13
|
[code]IF @@ROWCOUNT > 1 BEGIN RAISERROR('This is the error message.', 16, 1) RETURN -100 END[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
rkuhnjr
Starting Member
2 Posts |
Posted - 2008-11-04 : 15:39:45
|
| Thanks!I tried using Raiseerror but had the severity set at 0 so it was still reporting successThanks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-04 : 15:58:05
|
Only severities 11 and above is reported as error. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|