Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. stored procedure

stored procedure

Scheduled Pinned Locked Moved Database
databasehelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thanusree Duth
    wrote on last edited by
    #1

    SELECT DISTINCT DATEOFWORKS,EMPNAME,DEPARTMENT,SHIFTTIME,FIRSTTIMEIN,LASTTIMEOUT,WORKINGHOURS,BREAKDURATION from [dbo].[fn_emp_Workdetails]('2833409','9/25/2010','9/26/2010')INNER JOIN [dbo].[fn_FirstTimeIn_LasttimeOut] ('2833409','9/25/2010','9/26/2010') ON [dbo].[fn_emp_Workdetails].EMPID=[dbo].[fn_FirstTimeIn_LasttimeOut].EMPLID INNER JOIN [dbo].[fn__Emp_Working_Hrs]('2833409','9/25/2010','9/26/2010') ON [dbo].[fn_emp_Workdetails].EMPID= [dbo].[fn__Emp_Working_Hrs].EMPLOYEE_ID INNER JOIN [dbo].[fn__Break_Duration]('2833409','9/25/2010','9/26/2010') ON [dbo].[fn_emp_Workdetails].EMPID=[dbo].[fn__Break_Duration].EMPLOY_ID In this stored procedure,the output is 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 2:15:17 0:21:-24 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 2:15:17 0:0:0 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 2:15:17 0:21:-24 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 5:12:24 0:0:0 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 2:15:17 0:0:0 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 5:12:24 0:0:0 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 5:12:24 0:21:-24 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 5:12:24 0:21:-24 The same row appear several times.Please help me to select one row only one times.By using 'distinct' it wouldnt become correct..pls help

    M 1 Reply Last reply
    0
    • T Thanusree Duth

      SELECT DISTINCT DATEOFWORKS,EMPNAME,DEPARTMENT,SHIFTTIME,FIRSTTIMEIN,LASTTIMEOUT,WORKINGHOURS,BREAKDURATION from [dbo].[fn_emp_Workdetails]('2833409','9/25/2010','9/26/2010')INNER JOIN [dbo].[fn_FirstTimeIn_LasttimeOut] ('2833409','9/25/2010','9/26/2010') ON [dbo].[fn_emp_Workdetails].EMPID=[dbo].[fn_FirstTimeIn_LasttimeOut].EMPLID INNER JOIN [dbo].[fn__Emp_Working_Hrs]('2833409','9/25/2010','9/26/2010') ON [dbo].[fn_emp_Workdetails].EMPID= [dbo].[fn__Emp_Working_Hrs].EMPLOYEE_ID INNER JOIN [dbo].[fn__Break_Duration]('2833409','9/25/2010','9/26/2010') ON [dbo].[fn_emp_Workdetails].EMPID=[dbo].[fn__Break_Duration].EMPLOY_ID In this stored procedure,the output is 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 2:15:17 0:21:-24 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 2:15:17 0:0:0 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 2:15:17 0:21:-24 25/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 5:12:24 0:0:0 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 2:15:17 0:0:0 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 5:12:24 0:0:0 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 7:12:09:000PM 12:45:09:000AM 5:12:24 0:21:-24 26/09/2010 NithaV.G Development 7:00:00:000PM- 3:00:00:000AM 12:59:59:000AM 3:15:16:000AM 5:12:24 0:21:-24 The same row appear several times.Please help me to select one row only one times.By using 'distinct' it wouldnt become correct..pls help

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Use dateparts to remove the time component of the fields with time values. You can also do a double convert > varchar using a formater convert(varchar(20),date,103), then convert the result back to datetime format and use that in the report

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups