• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Help with MS SQL DateTime Query

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    Originally posted by MarillionFan
    You bunch of bloody SQL amateurs. I put a question up about SQL no-one apart of Socky can answer it, someone puts a simple question up you all smarm over who can answer it.

    Winging it, you're all bloody winging it.
    Its Christmas. You know, the time to be jolly, give and receive presents, and of course provide dodgy, half cut solutions to questions about all and sundry!!!!

    Seriously tho, wtf am I doing working at 7:15am just 3 days before xmas. If ever there was a working condition that says I'm not a bloody employee, this is it!!!!!

    Comment


      #12
      Originally posted by MarillionFan
      You bunch of bloody SQL amateurs. I put a question up about SQL no-one apart of Socky can answer it, someone puts a simple question up you all smarm over who can answer it.

      Winging it, you're all bloody winging it.
      You put up a question about SQL Server, mate. I don't do that, I only do SQL (on real databases - Oracle and DB2). And I'm really pissed off with "SQL Server" polluting Google, and indeed Jobserve, for those of us who are looking for "SQL".

      Comment


        #13
        Firstly, thanks for all that answered my pleas for help on this SQL statement – all is working really well now.
        Weltchy also asked why I was not formatting the date in application code?
        I am actually using the SQL code in a stored procedure and then displaying the results in a net2 grid view. Figured that if I could get the stored proc to out put in the correct format that I wanted – then I could reference the proc in other area of my web page.

        I did mention that I am not a programmer – so most likely this sis a more efficient way of doing this but right now the following works well for me.

        SELECT TOP (5)
        NickName AS Chaser,
        Speed,
        Direction,
        Altitude,
        CONVERT(char(5), (getutcdate()- gpsTime), 108) AS [Time ago],
        CASE TrackerID
        WHEN 'Tracker 1' THEN '1'
        WHEN 'Tracker 2' THEN '2'
        WHEN 'Tracker 3' THEN '3'
        WHEN 'Tracker 4' THEN '4'
        WHEN 'Tracker 5' THEN '5'
        WHEN 'Tracker 6' THEN '6'
        WHEN 'Tracker 7' THEN '7'
        WHEN 'Tracker 8' THEN '8'
        WHEN 'Tracker 9' THEN '9'
        WHEN 'Tracker 10' THEN '10'
        END AS [GPS]
        FROM TrackerData
        WHERE DATEDIFF(hour, gpsTime, GETUTCDATE()) < 12
        ORDER BY gpsTime DESC
        www.stormtrack.co.uk - My Stormchasing website.

        Comment

        Working...
        X