Results 1 to 6 of 6

Thread: DateTime Issue

  1. #1
    Join Date
    Sep 2004
    Posts
    76

    Unanswered: DateTime Issue

    I don't like store time in smalldatetime field owing to application limitation, Is there any solution, let me help matter is most urgent and my application is too big.

    Thanking You

    R.Mall

  2. #2
    Join Date
    Dec 2003
    Location
    Bangalore
    Posts
    28
    What is the application limitation?? do u need to run queries aganist this column??

  3. #3
    Join Date
    Sep 2004
    Posts
    76
    Quote Originally Posted by cheriyan
    What is the application limitation?? do u need to run queries aganist this column??
    In totality it is big application already developped in PowerBuilder 7.3 and fullfill the need of business. That was with sybase, rightnow I am looking to port this data into MSSQL Server and application also tested on the MSSQL Server 2000, It is working as per need apart from date issue. Sybase doesn't need to store time with date, So I am looking similar datatype which doesn't need to store timestamp in date columns.

    Is the any way to resolve this issue at database level.

    Thanks

    R.Mall

  4. #4
    Join Date
    Dec 2003
    Location
    Bangalore
    Posts
    28
    Hi,

    SQL Server do not support Time data type as such...So to store a time only data u will have to store the integer portion of datetime datatype as 0 ...(i.e January 1, 1900)...

    But then if ur application does not allow u to use datetime datatype...may be try with CHAR.......

  5. #5
    Join Date
    Sep 2004
    Posts
    76
    How I can store only integer part in datetime colmns.

    Thanks

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by ravindramall
    How I can store only integer part in datetime colmns.
    make sure when you save a datetime value that you do not provide a time value as well

    so INSERT ... VALUES ... ( '2004-10-27' ... ) is okay, and the time portion of the value is set to 00:00:00

    however, INSERT ... VALUES ... ( getdate() ... ) includes a time

    if you want to strip the time, use

    ... cast(convert(char(10),getdate(),120) as datetime)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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