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

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 March 24th, 2012, 12:18 AM
aravindu aravindu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 7 aravindu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 26 m 28 sec
Reputation Power: 0
Firebird Query Help

Hello All.....

Is there any way to get the affected row count after executing a delete query.

example:

Delete from TBL_NAME where Id=1 returning rows_affected ;

i tried but shows error in query..

Looking for your help..

Thank You.

Reply With Quote
  #2  
Old May 9th, 2012, 03:57 PM
joeflinthiggins joeflinthiggins is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 14 joeflinthiggins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 33 sec
Reputation Power: 0
Hello,

You could just take a COUNT using the same WHERE statement before you delete. For example:

Code:
SELECT COUNT(*) FROM TBL_NAME WHERE Id=1;


As long as you use the same WHERE statement, that exact number of records will be deleted.

Joe

Reply With Quote
  #3  
Old May 10th, 2012, 02:23 AM
tsteinmaurer tsteinmaurer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 34 tsteinmaurer User rank is Lance Corporal (50 - 100 Reputation Level)tsteinmaurer User rank is Lance Corporal (50 - 100 Reputation Level)tsteinmaurer User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 5 h 2 m 19 sec
Reputation Power: 3
@aravindu: If you are fine doing that in PSQL (stored procedure, trigger, execute block), then check out the ROW_COUNT context variable. Usually, access components like IBObjects, IBDAC ... AFAIK also offers a property which gives you the "rows affected", but this isn't part of the SQL statement then.

@joeflinthiggins: Only when running the SELECT and the DELETE in a single SNAPSHOT transaction.

HTH.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Firebird Query Help

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap