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. SELECT column FROM table WHERE time = @time ISSUE

SELECT column FROM table WHERE time = @time ISSUE

Scheduled Pinned Locked Moved Database
csharpdatabasehelpquestion
10 Posts 5 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.
  • H Offline
    H Offline
    Harvey Saayman
    wrote on last edited by
    #1

    Hey guys im having a slight problem with the above query, the problem is the value in the variable is like this "23:00" and the value in the table is "01-01-2008 23:00:00.000" how can i get the query to return the row i need irrespective of the date that is attached to the time? thanx,

    Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS

    you.suck = (you.passion != Programming)
    
    B S 2 Replies Last reply
    0
    • H Harvey Saayman

      Hey guys im having a slight problem with the above query, the problem is the value in the variable is like this "23:00" and the value in the table is "01-01-2008 23:00:00.000" how can i get the query to return the row i need irrespective of the date that is attached to the time? thanx,

      Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS

      you.suck = (you.passion != Programming)
      
      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      select convert(varchar(10),columnname,108) from myTable it will return this format HH:mm:ss hope it helps to you...


      I Love T-SQL

      H S S 3 Replies Last reply
      0
      • H Harvey Saayman

        Hey guys im having a slight problem with the above query, the problem is the value in the variable is like this "23:00" and the value in the table is "01-01-2008 23:00:00.000" how can i get the query to return the row i need irrespective of the date that is attached to the time? thanx,

        Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS

        you.suck = (you.passion != Programming)
        
        S Offline
        S Offline
        Sivu
        wrote on last edited by
        #3

        Hey man, You can use DATEPART to get the different parts of the date. select right('0' + convert(varchar, datepart(hh, time)), 2) + ':' + right('0' + convert(varchar, datepart(mi, time)), 2) + ':' + right('0' + convert(varchar, datepart(ss, time)), 2) With the date you've given as an example, this would return the string "23:00:00". Hope this helps...

        1 Reply Last reply
        0
        • B Blue_Boy

          select convert(varchar(10),columnname,108) from myTable it will return this format HH:mm:ss hope it helps to you...


          I Love T-SQL

          H Offline
          H Offline
          Harvey Saayman
          wrote on last edited by
          #4

          thanx dude, im sure it will work!

          Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS

          you.suck = (you.passion != Programming)
          
          B 1 Reply Last reply
          0
          • B Blue_Boy

            select convert(varchar(10),columnname,108) from myTable it will return this format HH:mm:ss hope it helps to you...


            I Love T-SQL

            S Offline
            S Offline
            Sivu
            wrote on last edited by
            #5

            Oh, that's handy! i didn't know there was such easy conversion! :-D

            B 1 Reply Last reply
            0
            • H Harvey Saayman

              thanx dude, im sure it will work!

              Harvey Saayman - South Africa Junior Developer .Net, C#, SQL think BIG and kick ASS

              you.suck = (you.passion != Programming)
              
              B Offline
              B Offline
              Blue_Boy
              wrote on last edited by
              #6

              I guess it will work for you ;)


              I Love T-SQL

              1 Reply Last reply
              0
              • S Sivu

                Oh, that's handy! i didn't know there was such easy conversion! :-D

                B Offline
                B Offline
                Blue_Boy
                wrote on last edited by
                #7

                108 is returned format of datetime, also we have another formats like 100,101,102 and so on If you wanna check this syntax in T-SQL by changing format number select convert(varchar,getdate(),108)


                I Love T-SQL

                modified on Tuesday, April 22, 2008 6:09 AM

                C 1 Reply Last reply
                0
                • B Blue_Boy

                  108 is returned format of datetime, also we have another formats like 100,101,102 and so on If you wanna check this syntax in T-SQL by changing format number select convert(varchar,getdate(),108)


                  I Love T-SQL

                  modified on Tuesday, April 22, 2008 6:09 AM

                  C Offline
                  C Offline
                  Colin Angus Mackay
                  wrote on last edited by
                  #8

                  Blue_Boy wrote:

                  108 is returned format of datetime, also we have another formats like 100,101,102 and so on

                  Which means what? What does format "101" actually mean? Without further explanation your statement is meaningless. Technically correct, but meaningless all the same.

                  Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) My website | Blog

                  B 1 Reply Last reply
                  0
                  • C Colin Angus Mackay

                    Blue_Boy wrote:

                    108 is returned format of datetime, also we have another formats like 100,101,102 and so on

                    Which means what? What does format "101" actually mean? Without further explanation your statement is meaningless. Technically correct, but meaningless all the same.

                    Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Introduction to LINQ to XML (Part 1) - (Part 2) My website | Blog

                    B Offline
                    B Offline
                    Blue_Boy
                    wrote on last edited by
                    #9

                    for more-meaning use google search engine ;)


                    I Love T-SQL

                    1 Reply Last reply
                    0
                    • B Blue_Boy

                      select convert(varchar(10),columnname,108) from myTable it will return this format HH:mm:ss hope it helps to you...


                      I Love T-SQL

                      S Offline
                      S Offline
                      sonia sardana
                      wrote on last edited by
                      #10

                      hey frnd can u tell me what is 108 in the foll Query select convert(varchar(10),columnname,108) from myTable

                      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