PC Review


Reply
 
 
juli jul
Guest
Posts: n/a
 
      17th Mar 2005
Hello,
I am running in a loop ,doing some sql query (each time from another
table) and the result of each query is int result.
The problem is that the results suppose to be transfered to dataset ,and
the question how do I actovate the sql query command in Adapter in a
loop?
Thanks a lot!



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
DotNet Coder
Guest
Posts: n/a
 
      17th Mar 2005
Hi juli jul,

I would recommend doing this as a stored procedure and returning the results
as multiple select statements or multiple values.

<code>
CREATE PROCEDURE GetMutlipleTables
AS

SELECT Col1 FROM Table1

SELECT Col1 FROM Table2

SELECT Col1 FROM Table3

GO
</code>

This will return you a 3 table dataset that you can use any way you feel
fit. You can also return multiple values from multiple tables in one select
call also.

<code>
CREATE PROCEDURE GetMutlipleValues
AS

SELECT Table1.Col1 as 'FirstValue', Table2.Col1 as 'SecondValue',
Table3.Col3 as 'ThirdValue' FROM Table1, Table2, Table3

GO
</code>

Doing this on the C# side is not suggested.

HTH,
~d

"juli jul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> I am running in a loop ,doing some sql query (each time from another
> table) and the result of each query is int result.
> The problem is that the results suppose to be transfered to dataset ,and
> the question how do I actovate the sql query command in Adapter in a
> loop?
> Thanks a lot!
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
juli jul
Guest
Posts: n/a
 
      17th Mar 2005
Hello,
The problem is that I suppose to run over 200 tables.
I have two querries:
resolve all tables:
select name from objects where name like '%table%'

get rows count:
SELECT rows FROM indexes WHERE id = ID('<table_name>')

The first query returns me something like 200 table_names,how can I do
the secound in a loop (for each table) in stored procedure?
Thanks a lot!



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
DotNet Coder
Guest
Posts: n/a
 
      17th Mar 2005
You could use the 'sp_msforeachtable'
(http://www.databasejournal.com/featu...le.php/1490661) stored
procedure to do it.

<code>
exec sp_msforeachtable @command1='select count(*) as ''RowCount'' from ?'
</code>

If you run that in a stored procedure, you will still get over 200 tables
back into a dataset, but it should be 100X faster than looping through C#
and issuing commands to a SqlDataAdapter. Also, moving it to the database
server saves your client application from having to do all that ugly work.

HTH,
~d

"juli jul" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello,
> The problem is that I suppose to run over 200 tables.
> I have two querries:
> resolve all tables:
> select name from objects where name like '%table%'
>
> get rows count:
> SELECT rows FROM indexes WHERE id = ID('<table_name>')
>
> The first query returns me something like 200 table_names,how can I do
> the secound in a loop (for each table) in stored procedure?
> Thanks a lot!
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
juli jul
Guest
Posts: n/a
 
      19th Mar 2005

Hello,
but the problem is that I want specific tables than when I get the
almost 200 names (but there are only part of the tables in database) , I
need to enter another table and for each name to get the field with
number of rows (I don't need the count).
How can I imlement this? Thanks a lot!


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with Orange micro Adapter, looking for Ratoc FR1SX SCSI-Firewire-Adapter Christoph Rokitta Scanners 0 20th Apr 2007 09:14 AM
Modification of Nikon SA-21 strip film adapter to work like SA-30 roll adapter? Rosch Scanners 0 3rd Jan 2005 03:00 PM
Problem bridging Wireless adapter + (LAN adapter + cross cable CISCO device) Sandeep Khanna Windows XP Networking 3 5th Jul 2004 09:03 PM
Double-clicking network adapter's icon does not display adapter status. Bloke at the pennine puddle (Replace n.a.v.d with Windows XP Networking 0 25th Dec 2003 11:51 PM
Double-clicking network adapter's icon does not display adapter status. Bloke at the pennine puddle (Replace n.a.v.d with Windows XP General 0 25th Dec 2003 11:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:17 PM.