Announcement

Collapse
No announcement yet.

sql server 2005 timestamp now

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

  • sql server 2005 timestamp now

    möchte in ein Feld vom Typ "Timestamp" beim Einfügen eines Datensatzes automatisch ein Timestamp füllen. Ich dachte irgendwie mit now(). funkt aber nicht. hat jemand eine idee?


    Insert Into Measurement (fkCAPatientID, Timestamp, fkMeasureType)
    Values (1, now(), 1)

  • #2
    Timestamp ist kein Datum. Dafür brauchst du den datetime oder smalldatetime Datentyp.

    Erster Absatz aus der Hilfe zu Timestamp
    Timestamp is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type.

    Comment


    • #3
      ... und wenn es dann vom Typ 'datetime' ist, verwendest du statt now() einfach getdate() ...

      bye,
      Helmut

      Comment

      Working...
      X