Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Unanswered: Need to remove time stamp from output

    I've got a script that pulls the required info pretty well but I can not figure out how to remove the time stamp from the output. Just wondering if anyone has any suggestions.

    SELECT

    Response_Master_Incident.Response_Date,

    DateName(Weekday,Response_Master_Incident.Response _Date)AS DOW,

    Response_Master_Incident.Time_PhonePickUp AS TPPU,

    DateName(HOUR,Response_Master_Incident.Time_PhoneP ickUp)AS [DEM HR]



    FROM

    Response_Master_Incident LEFT OUTER JOIN Response_Vehicles_Assigned

    ON Response_Master_Incident.ID = Response_Vehicles_Assigned.Master_Incident_ID



    WHERE

    Response_Date between '05/01/2011 00:00:00' and '05/02/2011 00:00:00'

    AND(Response_Vehicles_Assigned.Cancel_Type IS NULL)

    AND (Response_Vehicles_Assigned.Response_Number IS NOT NULL)



    ORDER BY Response_Master_Incident.Response_Date;









    2011-05-01 00:01:02.000 Sunday 2011-04-30 23:52:20.000 23

    2011-05-01 00:09:00.000 Sunday 2011-05-01 00:09:03.000 0

    2011-05-01 00:11:00.000 Sunday 2011-05-01 00:11:39.000 0

    2011-05-01 00:17:42.000 Sunday 2011-05-01 00:17:31.000 0

    2011-05-01 00:23:07.000 Sunday 2011-05-01 00:22:38.000 0

    2011-05-01 00:26:34.000 Sunday 2011-05-01 00:23:20.000 0

    2011-05-01 00:34:07.000 Sunday 2011-05-01 00:33:22.000 0

  2. #2
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    What output do you want? A timestamp is a combination of a date and a time.

    Do you only want the date part? only the time part? nothing at all? only the first timestamp removed? only the second? both?

    Show us what output you want.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  3. #3
    Join Date
    Mar 2009
    Posts
    2

    Remove time stamp

    The date is fine to stay, it the time part that needs to go.

    Thanks

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    In SQL 2008, you could use the DATE datatype, if you have no need for the time portion at all. Or if this is purely for some report, you can use the CONVERT function to return just the date portion. There are several different formats to choose from, so you should look up the CONVERT function to see what your choices are.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    My first guess would be:
    Code:
    SELECT 
       Convert(CHAR(10), Response_Master_Incident.Response_Date, 121) AS Response_Date
    ,  DateName(Weekday,Response_Master_Incident.Response _Date)AS DOW
    ,  Convert(CHAR(10), Response_Master_Incident.Time_PhonePickUp, 121) AS TPPU
    ,  DateName(HOUR,Response_Master_Incident.Time_PhoneP ickUp)AS [DEM HR]
       FROM 
          Response_Master_Incident
          LEFT OUTER JOIN Response_Vehicles_Assigned
             ON (Response_Master_Incident.ID = Response_Vehicles_Assigned.Master_Incident_ID)
       WHERE  Response_Date BETWEEN '05/01/2011 00:00:00' AND '05/02/2011 00:00:00' 
          AND Response_Vehicles_Assigned.Cancel_Type IS NULL
          AND Response_Vehicles_Assigned.Response_Number IS NOT NULL
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •