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.

Empfohlene Antworten

Veröffentlicht

Hi ihr,

ich habe in einer Tabelle eine Spalte die automatisch eine ID vergibt (generated by default as identity (start with 1)).

Nun füge ich in diese Tabelle einen Datensatz ein und würde gerne per SQL Abfragen welche ID dieser Datensatz bekommen hat!

Ich habe gelesen das man die Funktion IDENTITY_VAL_LOCAL() verwenden soll, aber diese Stellt ja nicht sicher das dazwischen noch weiter Insert ausgeführt werden - also wie macht man das unter DB2?

Gruß Cooli

eine möglichkeit wäre :

select max(id) from tabellenname;

Allerdings nicht die sauberste.

Bitte unterlass es diese Art von Tipps zu geben, auch wenn du geschrieben hast, das das unsauber ist.

IDENTITY_VAL_LOCAL() kenne ich nicht, du kannst aber bei DB2 so wie auch bei Oracle mit sequenzen arbeiten.

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/db2/rbafzmstcsequence.htm

Gruß Jaraz

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.