C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » SQL Server »

Give stored procedure


Posted Date: 26 Aug 2008      Posted By: venkatesan      Member Level: Diamond     Points: 1   Responses: 5



Hi

Let me know suppose

i have query like check the email exist in database or not..

for that i need SP with i have to check in Stored Procedure itself

ie: if the SP return = 0 it should no show the msg like "Email does not exist "

else it shows "Email Already Exist"

Generally we write the stored procedure

and using the result of the SP we will check in Code

if i=0
msg show "Email doesnot exist"

else
Already exist

But i need the above should be get it from Stored procedure itself..

Thanks


Regards,
M.Venkatesan.
Dot Net Code Snippets





Responses

Author: avtar    26 Aug 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 3

Use this select statement in ur SP

declare @c int
set @c = 2
select @c
select Out =
CASE @c
WHEN 0 THEN 'Email doesnot exist'
WHEN -1 THEN 'Email Already exist'
ELSE 'Invalid'
END



Author: venkatesan    26 Aug 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 1

Hi can u give the full SP

so let you define clearly..

Regards,
M.Venkatesan.
Dot Net Code Snippets



Author: avtar    26 Aug 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 4

Create procedure Test
as
begin
declare @c int
set @c = 2
select @c
select Out =
CASE @c
WHEN 0 THEN 'Email doesnot exist'
WHEN -1 THEN 'Email Already exist'
ELSE 'Invalid'
END

end

try to change value of @c to 0 , -1 and see teh output



Author: venkatesan    26 Aug 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 0

i think u didnt got my point..

Regards,
M.Venkatesan.
Dot Net Code Snippets



Author: Vijayaragavan.R    27 Aug 2008Member Level: BronzeRating: 2 out of 52 out of 5     Points: 4

Create procedure Test
as
begin
declare @c int
set @c = 2
select @c
select Out =
CASE @c
WHEN 0 THEN 'Email doesnot exist'
WHEN -1 THEN 'Email Already exist'
ELSE 'Invalid'
END

end

try to change value of @c to 0 , -1 and see teh output



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Difference Between SSIS and DTS
Previous : Database is in suspect mode
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use