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 October 3rd, 2004, 10:35 AM
H2SO4 H2SO4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 H2SO4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ISQL & trigger

Hi !
I need a ID (type COUNTER) field in my table, and I discovered that with firebird I have to create a generator to achieve the result
(But why ? isn't counter a SQL92 standard ?? )

Just to try and see what happens, I tried with Mitec IBQuery the exaple given in
http://firebird.sourceforge.net/manual/migration-mssql-data-types.html

Considering the command was given interactively, i prepended the
SET TERM !! ; as advised in http://www.destructor.de/firebird/storedproc.htm

But after having created the exaple table and the example generator, when I try to execute the trigger command here's what happens:
SET TERM !! ;
CREATE TRIGGER my_before_trigger FOR my_table
BEFORE INSERT
AS
BEGIN IF (NEW.my_number IS NULL) THEN NEW.my_number = GEN_ID(my_generator, 1) END !!
set term ; !!

What I get is
Statement #2:
Dynamic SQL Error
SQL error code = -104
Token unknown - line 5, char 80
END

Why ?

H2SO4

Reply With Quote
  #2  
Old October 4th, 2004, 04:50 AM
hugo2 hugo2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 20 hugo2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 14 sec
Reputation Power: 0
Quote:
Originally Posted by H2SO4
Hi !
I need a ID (type COUNTER) field in my table, and I discovered that with firebird I have to create a generator to achieve the result
(But why ? isn't counter a SQL92 standard ?? )

Just to try and see what happens, I tried with Mitec IBQuery the exaple given in
http://firebird.sourceforge.net/manual/migration-mssql-data-types.html

Considering the command was given interactively, i prepended the
SET TERM !! ; as advised in http://www.destructor.de/firebird/storedproc.htm

But after having created the exaple table and the example generator, when I try to execute the trigger command here's what happens:
SET TERM !! ;
CREATE TRIGGER my_before_trigger FOR my_table
BEFORE INSERT
AS
BEGIN IF (NEW.my_number IS NULL) THEN NEW.my_number = GEN_ID(my_generator, 1) END !!
set term ; !!

What I get is
Statement #2:
Dynamic SQL Error
SQL error code = -104
Token unknown - line 5, char 80
END

Why ?

H2SO4


Read documentation. Syntax for Assignment statement is
variable = <expression> ;

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > ISQL & trigger


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 2 hosted by Hostway