Subject | RE: [firebird-support] How To Generate Auto Increment Number in SQL Itself ? |
---|---|
Author | Louis van Alphen |
Post date | 2015-03-13T12:19:56Z |
select
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
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: 13 March 2015 01:58 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?
Hi All,
I have one question, any SQL I write, I would like to get auto-increment number (separate column obviously) to every row starting with 1. It is just to numbering every record I get as an output of my sql. I do not want to use Generate which we do on table. This is just for SQL output I need.
Thanks In Advance.
With Best Regards.
Vishal
[Non-text portions of this message have been removed]
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
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: 13 March 2015 01:58 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?
Hi All,
I have one question, any SQL I write, I would like to get auto-increment number (separate column obviously) to every row starting with 1. It is just to numbering every record I get as an output of my sql. I do not want to use Generate which we do on table. This is just for SQL output I need.
Thanks In Advance.
With Best Regards.
Vishal
[Non-text portions of this message have been removed]