SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Sql Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kbinay2009
Starting Member

India
3 Posts

Posted - 09/13/2013 :  04:14:48  Show Profile  Reply with Quote
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

Edited by - kbinay2009 on 09/13/2013 04:34:00

VeeranjaneyuluAnnapureddy
Posting Yak Master

India
169 Posts

Posted - 09/13/2013 :  06:28:15  Show Profile  Reply with Quote
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

India
3 Posts

Posted - 09/14/2013 :  02:50:00  Show Profile  Reply with Quote
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

India
169 Posts

Posted - 09/16/2013 :  06:47:09  Show Profile  Reply with Quote
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

Edited by - VeeranjaneyuluAnnapureddy on 09/16/2013 06:48:42
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000