|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi:
(1) How could I execute a Select/Insert statement which table name is not a constant in Trigger or Store Procedure? (2) How could I convert an int to a hexadecimal string? Thank you very much. Regards Eric |
|
#2
|
||||
|
||||
|
I don't know if there is a way to do a insert into a variable table, but ... why is it a variable ?
![]() |
|
#3
|
|||
|
|||
|
Hi:
Thank you for your reply. FYI, my current database design is each point's data will be write to a particular table based on it name (which is unique). Since there could be more than 10000 points and the data is inserted very frequently, I cannot dump all data to a table which will cause the search to be very slow. As a result, I need to insert/select data base on the point name. Sorry for my poor explanation. Thank you. |
|
#4
|
|||
|
|||
|
Dynamicaly build SQL statement in your SP body and then use execute statement.
-- Best regards, Fikret Hasovic http://fikret.fbtalk.net TAMP R&D Team FirebirdSQL Foundation member. - Join today at http://www.firebirdsql.org/ff/foundation JEDI VCS contributor http://jedivcs.sourceforge.net/ |
|
#5
|
|||
|
|||
|
Hi:
Thank you for your reply. Let say my statement is stored in a variable sqlstmt which I declare as varchar(256). How could I execute it? execute :sqlstmt ??? Thank you. |
|
#6
|
|||
|
|||
|
One example:
CREATE PROCEDURE EX_STATEMENT(TABLE_NAME VARCHAR(20)) AS DECLARE VARIABLE SQL_STATEMENT VARCHAR(255); BEGIN SQL_STATEMENT = some sql where you need TABLE_NAME EXECUTE STATEMENT SQL_STATEMENT; END -- Best regards, Fikret Hasovic http://fikret.fbtalk.net TAMP R&D Team FirebirdSQL Foundation member. - Join today at http://www.firebirdsql.org/ff/foundation JEDI VCS contributor http://jedivcs.sourceforge.net/ |
|
#7
|
|||
|
|||
|
Hi Fikret Hasovic,
Thank you very much for your infomation. Regards, lsteo |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Variable table name in Select/Insert in Trigger/Store Procedure? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|