Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm passing @AccountCode as the parameter to my stored procedure. If that AccountCode does not exist in the AccountMaster table, the a message must be printed saying 'The data is unavailable'. How do i do this?
Posted

1 solution

Hi,

you can try this one.

SQL
IF EXISTS (Select AccountID(Primary Key) From AccountMaster Where AccountCode = @AccoundCode)
BEGIN
  -- your logic
END
ELSE
BEGIN
 -- your message
END
 
Share this answer
 
Comments
bolshie6 30-Oct-12 1:48am    
works. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900