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 12th, 2006, 02:07 PM
webmaster_2x webmaster_2x is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 webmaster_2x User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m
Reputation Power: 0
Question regarding TSql vs SQL used in Fb

to be honest... i never had need to use any db rather than sql server.

i had developed a little apoplication with three sql statements too simple to be mentioned but an idea from a friend caused me to try firebird.

in fact... i'm stuck! i've tried many docs, most require one take a long time reading through technical documents but for me this is not suitable.

so i put my code here and waiting for a kind expert to translate it for me. i appreciate your kind reply.

i realised that select in code sql is different from select in a stored proce. i could not managed this through stored proc and i need it. application works but in a basic manner: i broke these statement in parts and execute them through one by one steps.

if((SELECT Count(*) FROM [TABLENAME] WHERE [Field1]=N'aaa' AND [Field2]=N'bbb') = 0)
begin
INSERT INTO [TABLENAME]([Field1], [Field2]) VALUES(N'aaa', N'bbb')
select @@IDENTITY as Result
end
else
select -1 as Result

thanks in advance.

Reply With Quote
  #2  
Old September 13th, 2006, 02:20 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,815 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 1 Day 14 m 37 sec
Reputation Power: 278
Your code seems very MsSQL specific, you would find the same difficulties with every other database, I'd suggest you start reading.

Reply With Quote
  #3  
Old September 13th, 2006, 02:34 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,815 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 1 Day 14 m 37 sec
Reputation Power: 278
Let me add that Firebird comes with a sample database (employee.fdb) which holds some stored procs also, those are good examples.
You are also using IDENTITY which is not supported in Firebird (and Postgresql and Oracle ....) where you'll find that the same is accomplished with a mix of generators and triggers, so the problem of retrieving the identity field value after an insert is completely different.

Last edited by pabloj : September 13th, 2006 at 02:36 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Question regarding TSql vs SQL used in Fb


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