|
Home > Archive > MS SQL Server MSEQ > June 2005 > Stored Procedure - Obtaining Output
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Stored Procedure - Obtaining Output
|
|
|
| Hi,
I would like to set up a stored procedure that does the following...
- Check does a record exist in a table
- Return the result (as True or False)
My query is simply
SELECT * FROM TABLE WHERE CODE = '123'
How to I trap the output of this query (as a True or False)!
Thanks,
Wez
| |
| Hari Prasad 2005-06-14, 8:25 pm |
| Hi,
Use the below sample:-
Create proc testproc
as
Begin
IF EXISTS(SELECT 'x' FROM TABLE WHERE CODE = '123')
Select 'True'
Else
Select 'False'
End
Thanks
Hari
SQL Server MVP
"Wes" <Wes@discussions.microsoft.com> wrote in message
news:7E26CCDA-0C47-42F6-99F8- 40C29A260BF5@microso
ft.com...
> Hi,
>
> I would like to set up a stored procedure that does the following...
> - Check does a record exist in a table
> - Return the result (as True or False)
>
> My query is simply
> SELECT * FROM TABLE WHERE CODE = '123'
>
> How to I trap the output of this query (as a True or False)!
>
> Thanks,
> Wez
|
|
|
|
|