General discussion

Locked

Need T-SQL Help

By bob ·
I have 7 fields:
vdrWorkComp (bit) is true or false as to whether we need a current Workman's Comp certificate from the vendor.
vdrWorkCompExp (datetime) - the date the Workman's Comp certificate expires, if we need one.
vdrLiabilityIns (bit) istrue of false as to whether we need a current Liability Insurance certificate from the vendor.
vdrLiabilityInsExp (datetime) - the date the Liability Insurance certificate expires, if we need one.
vdrPriceAgreement (bit) is true or false as to whether we need a current Price Agreement with the vendor.
vdrPriceAgreementExp (datetime) - the date the Price Agreement expires, if we need one
vdrActive (bit) is true or false depending... here's the logic:

If a Vendor needs any one of the three, then they must be current to be active. If it is a Vendor we don't need any one of even all of them from, then they are active. So, for example, Vendor Joe Bugsplatt might need Liability and a Price agreement, but not Workman's Comp, so he is Active if Liability Insurance and Price Agreement are current, and Workman's Comp is ignored. Some Vendors don't get any, but are still Active - like Government Permitting Agencies.

I want to write this in a scheduled task that will sweep the table every night to see if anyone's status changed. I tried writing it, but I got so many if...then statements wrapped around one another, I nearly choked myself! LOL!!!

Advice? Suggestions?

Thanks,

Bob

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Got it! Thanks

by bob In reply to Need T-SQL Help

Got a response of the Microsoft Newsgroups that set me on track. THanks!!!

Bob

Collapse -

What did they say?

by shelleydoll In reply to Got it! Thanks

If you've got time to post the solution, it might help someone else with the same issue...

Thanks!

Collapse -

Well ... probably something like this

by rwblaas In reply to What did they say?

I haven't seen the reply nor do I know which post the mailer is refering to but my solution would be using the CASE statement. That would simplify the IF THEN ELSE statements thoroughly.

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums