Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Datetime Uns Timestamp

Empfohlene Antworten

Veröffentlicht

Was ist da der Unterschied? Welches ist besser? und warum?Warum Datetime?warum Timestamp?

ciao baby18

Im Groben:

Datetime stellt Datumswerte vom 1. Januar 1753 bis 31. Dezember 9999 dar.

Timestamp enthält neben dem Datum noch eine genaue Uhrzeit in unterschiedlichen Formaten, z.B. 2004-01-15 09:55:39:1754

HTH

D_Z

en Detail ;)

(Quelle: SQL-Server 2000 Dokumentation, Stichwort: timestamp)

timestamp is a data type that exposes automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes. ... A table can have only one timestamp column. The value in the timestamp column is updated every time a row containing a timestamp column is inserted or updated. ... A nonnullable timestamp column is semantically equivalent to a binary(8) column. A nullable timestamp column is semantically equivalent to a varbinary(8) column.

(Quelle: SQL-Server 2000 Dokumentation, Stichwort: datetime)

Values with the datetime data type are stored internally by Microsoft SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date, January 1, 1900. The base date is the system reference date. Values for datetime earlier than January 1, 1753, are not permitted. The other 4 bytes store the time of day represented as the number of milliseconds after midnight.

Essentiell sind die Unterschiede also extrem.

1. timestamp ist aktuell nicht SQL-92 konform.

2. timestamp ist mit hoher Wahrscheinlichkeit nicht "aufwärtskompatibel".

3. timestamp darf in jeder Tabelle nur einmal auftreten.

4. timestamp wird automatisch bei update und insert aktualisiert.

5. timestamp dient, entsprechend seinem Namen "Zeitstempel", lediglich damit als Indikator für Änderungserfassungen.

6. timestamp erfasst ein "Pseudodatum", das mehr ein eindeutiges (hier liegt die Betonung) "Datum" (also einen Datenwert) repräsentiert, als das, was üblicherweise der Volksmund meint, wenn er von Daten spricht und Kalenderdaten meint.

7. timestamp lässt sich als datetime casten. Diese Umwandlung ergibt aber nur dann Sinn, wenn berücksichtigt wird, dass der Ergebniswert kein echtes Datum, sondern lediglich einen tabellenweit eindeutigen Binärwert ergibt, dessen Zählung in jeder Datenbank beim "Pseudodatum" 1.1.1900 00:00:00.000 beginnt, und der im Zuge der Eindeutigkeit (als einzigem Parameter) geändert wird.

Kurz gesagt: timestamp ist kein echtes Datum, kann aber dafür missbraucht werden.

8. datetime hingegen hat die Funktion, ein "reguläres" Kalenderdatum, ganz wie Darth_Zeus es bereits beschrieb, zu erfassen. In Erweiterung seiner Darstellung erfasst datetime auch die Zeit als 4-Byte-Wert, gemessen in Millisekunden nach Mitternacht.

(Diese Liste erhebt keinen Anspruch auf Vollständigkeit.)

Hinweis:

](Quelle: SQL-Server 2000 Dokumentation, Stichwort: timestamp)

The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.

A future release of Microsoft® SQL Server™ may modify the behavior of the Transact-SQL timestamp data type to align it with the behavior defined in the standard. At that time, the current timestamp data type will be replaced with a rowversion data type.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.