•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 423,879 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,196 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 8160 | Replies: 0
![]() |
•
•
Join Date: Jul 2005
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
Hi, all!
I need to load base from ODBC-source into MSSql base using MsSql DTS at my customer's side with
automatic as much as possible('Pushing 1 buton').
I have found such an example:
DECLARE @object int
DECLARE @hr int
--create a package object
EXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUT
if @hr <> 0 BEGIN
print 'error create DTS.Package'
RETURN -1
END
EXEC @hr = sp_OAMethod @object, 'LoadFromStorageFile',
NULL, 'C:\Test.dts', ''
IF @hr <> 0 BEGIN
print 'error LoadFromStorageFile'
RETURN -2
END
EXEC @hr = sp_OAMethod @object, 'Execute'
IF @hr <> 0 BEGIN
print 'Execute failed'
RETURN -3
END
It works for my DTS-file. But I need change programmatically connection parameters, login and password of connection,
not use connection parameters that I set manually in my DTS-Package.
In this packete as a source of datas "Connection Properties" with ODBC DataSource as source of my datas,
it's login and password.
Then destination is object "Connection Properties" with DataSource Microsoft Ole DB tuned to base I need,
login and password. there are about 20 objects "Transform Data Task". In doc I found function
sp_OAMethod with method "Connect":
EXEC @hr = sp_OAMethod @object, 'Connect', NULL, 'my_server', 'my_login', 'my_password'
IF @hr <> 0 BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
But how can I do with it as I have two bases: source and destination?
Thanks in advance,
Nilov Serge.
I need to load base from ODBC-source into MSSql base using MsSql DTS at my customer's side with
automatic as much as possible('Pushing 1 buton').
I have found such an example:
DECLARE @object int
DECLARE @hr int
--create a package object
EXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUT
if @hr <> 0 BEGIN
print 'error create DTS.Package'
RETURN -1
END
EXEC @hr = sp_OAMethod @object, 'LoadFromStorageFile',
NULL, 'C:\Test.dts', ''
IF @hr <> 0 BEGIN
print 'error LoadFromStorageFile'
RETURN -2
END
EXEC @hr = sp_OAMethod @object, 'Execute'
IF @hr <> 0 BEGIN
print 'Execute failed'
RETURN -3
END
It works for my DTS-file. But I need change programmatically connection parameters, login and password of connection,
not use connection parameters that I set manually in my DTS-Package.
In this packete as a source of datas "Connection Properties" with ODBC DataSource as source of my datas,
it's login and password.
Then destination is object "Connection Properties" with DataSource Microsoft Ole DB tuned to base I need,
login and password. there are about 20 objects "Transform Data Task". In doc I found function
sp_OAMethod with method "Connect":
EXEC @hr = sp_OAMethod @object, 'Connect', NULL, 'my_server', 'my_login', 'my_password'
IF @hr <> 0 BEGIN
EXEC sp_OAGetErrorInfo @object
RETURN
END
But how can I do with it as I have two bases: source and destination?
Thanks in advance,
Nilov Serge.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Problem connecting to the database after changing the database server (ASP.NET)
- Error is [Microsoft][ODBC SQL Server Driver]Connection is busy (JSP)
- C# VS 2005 - SQL Query Parameters to an ODBC DataSource (C#)
- Help With SQL Server Agent (MS SQL)
- ASP.net/Stored Proc & Login Verification (ASP.NET)
- Prblem with sql sever connection (ASP.NET)
- SQL server error: 18452 - connection to SQL error (Windows NT / 2000 / XP / 2003)
Other Threads in the MS SQL Forum
- Previous Thread: Query conversion from Sybase to MS SQL Server 2000
- Next Thread: how do I run a "disconnected" stored procedure


Linear Mode