By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,843 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,843 IT Pros & Developers. It's quick & easy.

ELSE IF statements

P: 11
Hi I have a stored procedure which returns DBNULL if "Line" is empty rather than returning EquipmentNumber:

Expand|Select|Wrap|Line Numbers
  1. IF EXISTS (SELECT Line FROM Equipment WHERE Department = @Department)
  3. SELECT DISTINCT Line FROM Equipment WHERE Department = @Department
  5. ELSE 
  7. SELECT DISTINCT EquipmentNumber FROM Equipment WHERE Department = @Department
Error messege "Unable to cast object of type 'System.DBNull' to type 'System.String'."
Mar 14 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.