Subject RE: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?
Author Louis van Alphen
Thanks… I needed it to be able to structure a complex report.



From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: 13 March 2015 02:35 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?





Louis,

That's some clever get/set_context usage.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer) as row_number,

rdb$set_context('USER_TRANSACTION', 'row#',

coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer), 0) +
1),

< other columns>

from MY_TABLE





[Non-text portions of this message have been removed]