Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 20th, 2004, 02:00 AM
lsteo lsteo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 lsteo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Variable table name in Select/Insert in Trigger/Store Procedure?

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

Reply With Quote
  #2  
Old September 20th, 2004, 02:32 AM
SilverDB's Avatar
SilverDB SilverDB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Romania
Posts: 173 SilverDB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 45 m 53 sec
Reputation Power: 4
Send a message via Yahoo to SilverDB
Lightbulb

I don't know if there is a way to do a insert into a variable table, but ... why is it a variable ?

Reply With Quote
  #3  
Old September 20th, 2004, 02:42 AM
lsteo lsteo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 lsteo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

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.

Reply With Quote
  #4  
Old September 20th, 2004, 02:44 AM
fikret fikret is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Sarajevo, Bosnia
Posts: 111 fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 h 17 m 43 sec
Reputation Power: 7
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/

Reply With Quote
  #5  
Old September 20th, 2004, 03:28 AM
lsteo lsteo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 lsteo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile Could you show me an example?

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.

Reply With Quote
  #6  
Old September 21st, 2004, 02:48 AM
fikret fikret is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Sarajevo, Bosnia
Posts: 111 fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level)fikret User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 h 17 m 43 sec
Reputation Power: 7
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/

Reply With Quote
  #7  
Old September 21st, 2004, 08:11 PM
lsteo lsteo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 7 lsteo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Fikret Hasovic,

Thank you very much for your infomation.

Regards,
lsteo

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Variable table name in Select/Insert in Trigger/Store Procedure?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway