December 30, 2004 at 9:03 pm
Hi guys,
I am using ADO.NET and MSSQL 2000.
In a SP if you issue multiple "Select" statements, it will return multiple datatables. But now I just want the last result set. How can I tell MSSQL to only give me the last result set? I don't want to waste bandwidth to get back the extra ones.
Thanks.
Michael
December 31, 2004 at 5:46 am
What are the multiple SELECTs doing? IF they are populating variables research SET @var = (SELECT ...)
Good Hunting!
AJ Ahrens
webmaster@kritter.net
December 31, 2004 at 9:31 am
If you are using ADO, there are methods to move between the result sets.
January 6, 2005 at 1:13 am
First I used all three parameters, if there is any matching record, I can return immediately. If nothing is found, I run another query but this time just use two parameters. If nothing is found, then use just one in the query.
Therefore I may execute multiple SELECT statements in my SP. Hope it makes sense.
Thanks.
January 7, 2005 at 4:59 pm
Why not research using IF (SELECT COUNT(*) with 3 variables) <> 0 BEGIN END ELSE IF .... ???
Good Hunting!
AJ Ahrens
webmaster@kritter.net
January 7, 2005 at 6:40 pm
Will it be expensive (in term of time) if I first test (use SELECT COUNT) before I do the real SELECT? The SELECT statement to executed will involve joining more then 10 tables.?
Thanks for your help.
January 8, 2005 at 4:13 am
OW! Instead of COUNT(*) FROM you could look at something similar to what MS does for DROP/CREATE OBJECTS..
IF EXISTS (SELECT * FROM.. WITH 3 variables, then 2, etc...
This will evaluate much quicker and be less expensive then COUNT(*).
May just need to experiment and see which works better..
Good Hunting!
AJ Ahrens
webmaster@kritter.net
January 9, 2005 at 7:35 pm
Million thanks.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply