Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 is there possible to return message to front

Author  Topic 

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-02-06 : 01:15:36
hi,how to pass message to front end
select count(*) from emp where empno=1

if(count=0)
i want to pass "no records" to front end(vb.net)
if(count=1)
"records found"
is it possible to do this in sqlserver,if means please help me to do

Kristen
Test

22859 Posts

Posted - 2007-02-06 : 01:26:01
[code]
SELECT CASE WHEN COUNT(*) = 0
THEN 'no records'
ELSE 'records found'
END
from emp where empno=1
[/code]
Kristen
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-06 : 02:01:52
if exists (select null from emp where empno = 1)
select 'record(s) found'
else
select 'no records found'


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-02-06 : 02:24:39
hi peso and Kristen thank you very much for reply
Go to Top of Page
   

- Advertisement -