all groups > sql server odbc > september 2006 >
You're in the

sql server odbc

group:

Stored procedure output to MS-ACCESS in SQL Server 2000


Stored procedure output to MS-ACCESS in SQL Server 2000 santhoshks NO[at]SPAM gmail.com
9/8/2006 1:55:05 PM
sql server odbc:
I have a stored procedure which upon execution, the output needs to be
wrote onto a .mdb file..i need to do this as writing it through
MS-Access data component makes it very slow when used in c#.
Re: Stored procedure output to MS-ACCESS in SQL Server 2000 Mary Chipman [MSFT]
9/11/2006 12:23:57 PM
The fastest way to get stored procedure output into an Access mdb is
by using a pass-through query. These can be manipulated by setting a
DAO.QueryDef's .SQL property to a T-SQL "EXEC MyProc param1, param2"
statement. DAO is available to your C# code by using the Office
primary interop assemblies (PIAs) available at
http://support.microsoft.com/kb/328912.

--Mary

[quoted text, click to view]
Re: Stored procedure output to MS-ACCESS in SQL Server 2000 santhoshks NO[at]SPAM gmail.com
9/12/2006 7:26:13 AM
Hi thanks for the reply.
I am already using the interop assembly to write into .mdb.
my problem is when i used the interop assembly, i need to create the
access object first and then insert my dataset into the Access table.
When the number of records is very high e.g. around 200,000 the time
taken to insert the dataset into the access table is over 45
mins..Instead i want to use the Access object which is available in DTS
packages because when I tried to write into .mdb using the access
object in DTS package, the same 200,000 records got inserted int 5 mins
which is because SQL makes use of the data link object to write into
MS-Access.

The problem now i have in front of me is when i perform a DTS task to
write the query output to a .mdb file, I cannot use stored proc in its
direct form as the output columns of a stored proc wont be available to
create the table in MS-Access but when the query is executed directly
the output columns are automatically created in the MS-Access table.

Regards,
Santhosh

[quoted text, click to view]
Re: Stored procedure output to MS-ACCESS in SQL Server 2000 Mary Chipman [MSFT]
9/17/2006 8:15:25 PM
Would it work if you performed the operation in separate steps? If you
have the data schema (column names, data types) you can write interop
code to create the tables in the mdb. Once you have the tables, then
you can write a pass-through query to pull the data from the stored
procedure. Basically the more layers of API you have, the slower it's
going to be, and if you're doing inserts one row at a time with
200,000 rows, then you can expect to wait a while.

--Mary

[quoted text, click to view]
AddThis Social Bookmark Button