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 Query

Author  Topic 

kbinay2009
Starting Member

3 Posts

Posted - 2013-09-13 : 04:14:48
select isnull(Intime,'') +'-'+ isnull(dbo.fn_GetResult24h(outtime),'')+isnull('/'+intime1+'-'+dbo.fn_GetResult24h(outtime1),'') as 'Working Time' from empattendance where date1='2013-09-12'

output of above query is
07:02-15:56 / -

I want to remove "/-" if intime1 and outtime1 column is blank. the qery must be in sql select statemnet.

with regards,
Binay

VeeranjaneyuluAnnapureddy
Posting Yak Master

169 Posts

Posted - 2013-09-13 : 06:28:15
SELECT REPLACE((SELECT ISNULL(Intime,'') +'-'+ ISNULL(dbo.fn_GetResult24h(outtime),'')+ISNULL('/'+intime1+'-'+dbo.fn_GetResult24h(outtime1),'') AS 'Working Time'
FROM empattendance WHERE date1='2013-09-12'),'/ -','')

veeranjaneyulu
Go to Top of Page

kbinay2009
Starting Member

3 Posts

Posted - 2013-09-14 : 02:50:00
Hi, I am getting the following error while running the query in sql 2005...
"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."

with regards,
Binay.
Go to Top of Page

VeeranjaneyuluAnnapureddy
Posting Yak Master

169 Posts

Posted - 2013-09-16 : 06:47:09
Run The Query :

SELECT REPLACE(ISNULL(Intime,'') +'-'+ ISNULL(dbo.fn_GetResult24h(outtime),'')+ISNULL('/'+intime1+'-'+dbo.fn_GetResult24h(outtime1),''),'/ -','') AS 'Working Time'
FROM empattendance WHERE date1='2013-09-12'

veeranjaneyulu
Go to Top of Page
   

- Advertisement -