If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > getting count of query??? how?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-03, 23:19
shuchi shuchi is offline
Registered User
 
Join Date: Jan 2003
Posts: 55
getting count of query??? how?

hi all

ive got a problem once again.
i have a normal select query of the form:

select x,y,z from abc,def where conditions

now problem is that before executing the query itself i need to chk the count of the result itll return( that is num of rows that will be returned by my query) and only if the count matches a certain value want to execute it . If anyone knows how i can do ths please help me out with whatever hints/code u can..
thnx

-shuchi
__________________
You try and try again..but then give up, there's no sense in being a complete fool about it!!!
Reply With Quote
  #2 (permalink)  
Old 01-29-03, 00:15
shuchi shuchi is offline
Registered User
 
Join Date: Jan 2003
Posts: 55
Red face

oops ok i managed to get that..duhh used @@rowcount!..lol!
ok new problem tho..before using value of rowcount i have to specify the query ofcourse but i dont want it displayed.
any way i can select the relevant rows via a query but not display it as output but the rowcount value shud be updated

ne ideas..?hope there isnt another function for this!

-shuchi
__________________
You try and try again..but then give up, there's no sense in being a complete fool about it!!!
Reply With Quote
  #3 (permalink)  
Old 01-30-03, 06:53
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
Question ???

Hello,

please, first specify which database and which programs you use.
Otherwise it is very hard to help

Best regards

Manfred Peter
(Alligator Company GmbH)
http://www.alligatorsql.com
Reply With Quote
  #4 (permalink)  
Old 01-30-03, 07:35
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
yes, you can get a count, but not without executing some query

instead of

select x,y,z from abc,def where conditions

you can run

select count(*) from abc,def where conditions

@@rowcount is microsoft sql server, and you'll probably want to ask your question over in that forum -- http://dbforums.com/f7/

rudy
Reply With Quote
  #5 (permalink)  
Old 01-30-03, 07:56
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Quote:
Originally posted by r937

@@rowcount is microsoft sql server, and you'll probably want to ask your question over in that forum -- http://dbforums.com/f7/

rudy
Judhing by the number of SQL Server question posted in this forum, I think most people think SQL and SQL Server are synonymous! Trust Bill to manage to make SQL appear to be a Microsoft product!
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #6 (permalink)  
Old 01-30-03, 08:08
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
heh, yeah, i'm on (ahem) another forum site as well, where they have a forum called ANSI SQL, and we get sql server questions in there all the time

but as far as Bill's naming choice is concerned, what about mySQL, PL/SQL, postgreSQL, etc.

which kind of makes me wonder why this forum is called "SQL and PL/SQL"


rudy
Reply With Quote
  #7 (permalink)  
Old 01-30-03, 08:26
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
PL/SQL and SQL

Hello,

this forum is for general SQL and PL/SQL questions. PL/SQL is a language for creating stored units on an oracle based database.
like pgsql or mums or TSQL or or or ...

But, we try to answer every question even those, that are SQLServer based. But we need some little information to answer the question.

When I remember correctly @@rowcount is also a command in sybase, msql (not mysql) and caché.

Or it could be a sqlplus command

If a question is to specific, we move the question to the correct forum ....

Best regards

Manfred Peter
(Alligator Company GmbH)
http://www.alligatorsql.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On