Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Unanswered: Insert time and Date

    I am working on SQLServer2000. Actually i am exporting data from MATLAB to SQL Server and storing in a table. I want to insert the time and date of data inserted in SQL Server. Matlab only export data not the character string. I want SQL server table to insert date and time when it receives the data
    Please help me out to resolve this issue
    Last edited by wasifh; 11-05-10 at 13:32.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    it is not done with a procedure, it is done with an INSERT statement

    you did not say where the date and time are coming from, and you did not say which table they are supposed to go into

    so there's not much to go on here...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2010
    Posts
    3
    I am working on SQLServer2000. Actually i am exporting data from MATLAB to SQL Server and storing in a table. I want to insert the time and date of data inserted in SQL Server. Matlab only export data not the character string. I want SQL server table to insert date and time when it receives the data
    Please help me out to resolve this issue

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    A default constraint may be what you need, unless MATLAB is going to explicitly put a null in that field.

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    "MATLAB is a high-level technical computing language"

    run AWAY

    MATLAB - The Language Of Technical Computing

    Doesn't the silver bullet do it all for you?

    Why do you need sql server?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    All you need to do is put a default of GETDATE() or CURRENT_TIMESTAMP on your column. Make sure that the column itself is NOT referenced in your insert statement, because if you intentionally insert a NULL value, then that will take precedence over whatever default is set.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Nov 2010
    Posts
    3
    Thanks for this help, time function work for my application

Posting Permissions

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