Showing posts with label exec. Show all posts
Showing posts with label exec. Show all posts

Wednesday, March 7, 2012

Connecting to a Server to exec DTS Pkg

Hi;

Does anyone know the correct syntax for the DTS method

LoadFromSQlServer() ?

I tried objPkg.LoadFromSQlServer("Myserver",,,DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_trustedConnection, , , , "MyPackage") .

Here is the message that I receive :

[DBNETLIB]{ConnectionOpen(Invalid Instance)).]Invalid Connection.

Do I include the path along with the server name ? Or have I failed

to spell out the filename/path in my package ?

Sorry for this trivial question but I can't find that much info for

accessing/running a DTS pkg .

Thanks for your insights.

Is your server a named instance? What is the instance name then?

Could you also share out your connection string?

Thanks,

|||

I understand what you are saying.

So if I do object.LoadFromSQLServer("myserver\TYMR",,,256,,,"Package A")

the statement should work.

Thanks Man.

Sunday, February 19, 2012

connecting in a script to another db

hi.

I've tried to use the exec sql connect to ... in query analyzer, but could not
get it to parse.

Can someone show me how in a script, say the middle, I can connect to another
database and execute the remaining script lines there.

This way I can have a script update two separate db's at once.

Thanks
Jeff

Jeff KishJeff,

You can specify the from clause of SQL statements as
DATABASE.OWNER.TABLE, as long as they are on the same SQL Server. You
may also utilize the USE DATABASE command to change which database you
script will execute in. But, if you have different servers you want to
access, then that will not work unless you have set up Linked Servers.
In which case you would add the servername to the beginning of your
sting: SERVERNAME.DATABASE.OWNER.TABLE.

Update Table1 set C1 = 'YES' from Table1 T1, Table2 T2 where
T1.ReportID = T2ReportID

use DB2 --This Example will use both Databases to update the column

Update Table 4 set C5 = 'Report Printed' from Table4 T4, DB1.DBO.Table1
T1 where T4.ReportID = T1.ReportID

Steve|||On 23 Mar 2006 13:16:41 -0800, "sdyckes" <stephendyckes@.gmail.com> wrote:

>Jeff,
> You can specify the from clause of SQL statements as
>DATABASE.OWNER.TABLE, as long as they are on the same SQL Server. You
>may also utilize the USE DATABASE command to change which database you
>script will execute in. But, if you have different servers you want to
>access, then that will not work unless you have set up Linked Servers.
>In which case you would add the servername to the beginning of your
>sting: SERVERNAME.DATABASE.OWNER.TABLE.
>Update Table1 set C1 = 'YES' from Table1 T1, Table2 T2 where
>T1.ReportID = T2ReportID
>use DB2 --This Example will use both Databases to update the column
>Update Table 4 set C5 = 'Report Printed' from Table4 T4, DB1.DBO.Table1
>T1 where T4.ReportID = T1.ReportID
>Steve
Thanks Steve. They will be on the same SQL Server, so I can run with this.

Regards
Jeff Kish