How to get record number of dataset using row_number window function with over().
1 2 3 4 |
SELECT row_number() over(), t.* FROM test t |
Example of record number of dataset with even and odd column sorting.
1 2 3 4 5 6 7 8 9 |
SELECT row_number() over(), (CASE WHEN mod(row_number() over(),2) = 0 THEN 'even' ELSE 'odd' END) AS my_column, custom.* FROM ( SELECT t.* FROM test t ORDER BY t.description ) custom |
Unlike Firebird 2.5, Firebird 3 does not need a different DB connection library. In Windows, until today to distribute embedded Firebird fbembedd.dll was used instead of fbclient.dll, now with Firebird 3.0 fbclient.dll is always used both for the connection to a Firebird server and for the management of embedded / local DBs. In firebird the…
Read more
SmartFB is our internal tool to manage Firebird & Interbase databases, so we use smartFB instead IBExpert. SmartFB is a simple VCL program that we use to have an access to our databases in every PC and Virtual Machines where we not need a simple access to our databases. So we integrate in smartFB some…
Read more
Character set encoding In Firebird 3.0, as is known in a field of a varchar or char type table, it is possible to define the type of encoding managed, or not specific. Through Firebird it is possible to record the content of the story from one set of characters and another simply with the SQL…
Read more
Synaptica has always adopted Firebird as its main database environment for the realization of many solutions from embedded iot products to Web solutions with thousands of daily accesses. Firebird proved to be a great tool, flexible and easy to manage. For this reason we could not miss the appointment to meet the creators (Dmitry…
Read more
To enable and disable all triggers of a database i do two procedure : Enabling all database trigger:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
create procedure SP_ENABLE_ALL_TRIGGER as begin /* Procedure Text */ update RDB$TRIGGERS set RDB$TRIGGER_INACTIVE=0 where RDB$TRIGGER_NAME in( select A.RDB$TRIGGER_NAME from RDB$TRIGGERS A left join RDB$CHECK_CONSTRAINTS B ON B.RDB$TRIGGER_NAME = A.RDB$TRIGGER_NAME where ((A.RDB$SYSTEM_FLAG = 0) or (A.RDB$SYSTEM_FLAG is null)) and (b.rdb$trigger_name is null) AND (NOT(A.RDB$TRIGGER_NAME LIKE 'RDB$%')) ); suspend; end |
Disabling all database trigger:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
create procedure SP_DISABLE_ALL_TRIGGER as begin update RDB$TRIGGERS set RDB$TRIGGER_INACTIVE=1 where RDB$TRIGGER_NAME in( select A.RDB$TRIGGER_NAME from RDB$TRIGGERS A left join RDB$CHECK_CONSTRAINTS B ON B.RDB$TRIGGER_NAME = A.RDB$TRIGGER_NAME where ((A.RDB$SYSTEM_FLAG = 0) or (A.RDB$SYSTEM_FLAG is null)) and (b.rdb$trigger_name is null) AND (NOT(A.RDB$TRIGGER_NAME LIKE 'RDB$%')) ); suspend; end |