Click here to Skip to main content
15,905,616 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am trying to extract data from SQL SERVER 2008 database.Following is the description my task:

1. I have list of records(lets say 100) which I did extract using a SQL query from the database.

2. Some specific columns of each record should be given input to a stored procedure. The stored procedure returns three tables as the output.

3. I will have to catch only one of the table out of three and filter the columns data using another SQL query.

4. If the above filter condition is correct,I will save the column data(of step 1) in an excel.

5. I will have to repeat the process for all the 100 records and save the filtered data in an excel.

I considered it doing with below options but I am stuck and not able to proceed further:

1. Using SSIS

2. Using Nested Cursors

One option of doing that is by creating a user defined function for SP but I cannot do it because the data is in production environment.

Please let me know any process with which I can do it in a simpler manner.
Posted
Comments
Maciej Los 28-Feb-14 16:03pm    
Unclear!
V5709 28-Feb-14 23:53pm    
Have you tried with nested cursors?

1 solution

1. I have list of records(lets say 100) which I did extract using a SQL query from the database.
2. Some specific columns of each record should be given input to a stored procedure. The stored procedure returns three tables as the output.
3. I will have to catch only one of the table out of three and filter the columns data using another SQL query.

I do not understand why do you want to filter only one table from 3 returned by SP.

4. If the above filter condition is correct,I will save the column data(of step 1) in an excel.
5. I will have to repeat the process for all the 100 records and save the filtered data in an excel.

Sorry... Do you know how Structured Query Langage[^] works? There is no need to reapeat ptocess for all 100 records. SQL engine can compare all these 100 records. The result set can be saved to an Excel file.

What i suggest? Start with basics. Here[^] you'll find several tutorials.

For further information, please see:
Tutorial: Writing Transact-SQL Statements[^]
Writing SQL Queries: Let's Start with the Basics[^]
OLE DB Provider for Jet[^]

Please, read above tutorials and come back here with detailed question.
Cheers!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900