stroing time value without date in sql server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pvenkatesh2k4
    New Member
    • Feb 2008
    • 18

    stroing time value without date in sql server

    hi i need to store the time value alone in sql server database.i declared datetime type for that particular field. while inserting i need to store only time value, but it stores date also. how to insert time value alone for that particular filed?
    i also tried " insert into tblname values('12.30 PM')" but it inserts as 12.30 pm on jan 1 1900 ..
    please help to sort out this problem

    thanks in advance...
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Unfortunately Sql server only has a datetime field, which means that it stores a value with a date and time. If you only want to store a time value, then you can ignore the date part of it, and just use the time.

    I belive that SQL server 2008 has seperate date and time fields.

    Comment

    Working...