Re: Stored Procedure - Obtaining Output



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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7E26CCDA-0C47-42F6-99F8-40C29A260BF5@xxxxxxxxxxxxxxxx
> 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


.



Relevant Pages

  • Re: How do I print table definitions?
    ... Query the system view INFORMATION_SCHEMA.COLUMNS. ... Move the result into a Excel file and print it. ... Hari ... SQL Server MVP ...
    (microsoft.public.sqlserver.setup)
  • Re: FORMAT
    ... Hari ... SQL Server MVP ... I have a query that goes like: ... I know there is a FORMAT function in access, ...
    (microsoft.public.sqlserver.msde)
  • Re: Constraints
    ... I dont have a query for this with me. ... Hari ... > Foreign Key constraints are there in my database... ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.clients)
  • Re: FTS Performance in SQL 2005
    ... Can you post you query plans and the output of statistics IO ... SQL Server MVP ... Because i've set the MAX sql-server memory to 3.5 GB instead of 4.0 GB ... cost relative to the whole batch, ...
    (microsoft.public.sqlserver.fulltext)
  • Re: FTS Performance in SQL 2005
    ... Now if I do a query directly to the field I would theoretically need: ... SQL Server MVP ... Because i've set the MAX sql-server memory to 3.5 GB instead of 4.0 GB ... cost relative to the whole batch, ...
    (microsoft.public.sqlserver.fulltext)