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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 sql qry ..

Author  Topic 

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2007-03-13 : 02:35:22
Hi pals,

using EXISTS operator i need to display/output where the given employee no is existing or not i.e YES/NO.


select 1 from emp where empno=:v_empno

how to modify the above sql qry.


Regards,
franky

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-13 : 02:41:28
[code]
if exists (select * from emp where empno = @v_empno) print 'YES'
else print 'NO
[/code]


KH

Go to Top of Page

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2007-03-13 : 03:16:25
thank you very much.
Go to Top of Page
   

- Advertisement -