Re: how to return the result of execute sql programmatically



(universal) Data Link. See your right-click context menu, New File, or create new text file and rename to whatever.udl.

UDLs are just text files, so insecure for passwords.

You can get the result through an Execute SQL Task, so no ned for ADO if you don't like it. You can loop in DTS packages using workflow as well.



In message <O3UyYkNTFHA.2392@xxxxxxxxxxxxxxxxxxxx>, Ray5531 <RayAll@xxxxxxxxxxxx> writes
what's UDL?
"Paul Smith" <paul@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:%23yQQtPITFHA.548@xxxxxxxxxxxxxxxxxxxxxxx
If you use UDL's you can open it and parse the UID/PWD and use that.

"Ray5531" <RayAll@xxxxxxxxxxxx> wrote in message
news:eW8syABTFHA.3544@xxxxxxxxxxxxxxxxxxxxxxx
The problem of using ado is that which user name and password shall I
use? I'd like to schadule the package in another server which my password
of integrated security might not work.

Any ideas?

Thanks
"Darren Green" <darren.green@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:I+gHlCSqeIcCFwRQ@xxxxxxxxxxxxx
In message <OGHR$S4SFHA.3392@xxxxxxxxxxxxxxxxxxxx>, Ray5531
<RayAll@xxxxxxxxxxxx> writes
I'm calling an Execute sql task from my script programmatically and I
want
it to return its result which is a count into a global variable?? How
should
I specify it?

Thanks


' Get Package Object Set oPkg2 = DTSGlobalVariables.Parent ' Get Exec SQL CustomTask Set oExecSQL = oPkg2.Tasks("DTSTask_DTSExecuteSQLTask_1").CustomTask ' Build new SQL Statement sSQLStatement ="SELECT COUNT(ACTIVE_STATUS) AS countActive FROM IF_CONFIG_SETTINGS WHERE (IFCODE =" & _ iIFCode & ")"


' Assign SQL Statement Exec SQL Task oExecSQL.SQLStatement = sSQLStatement ' Clean Up Set oExecSQL = Nothing Set oPkg2 = Nothing

     'EXIT from function if there is another instance of the same
package
is running
     IF DTSGlobalVariables("gCountActivePackage").Value > 0 THEN EXIT
FUNCTION



You cannot use an Execute SQL Task from within a script task. To execute a statement directly in script, use ADO.

You can use the script to set the SQLStatement of the task, but let
normal workflow execute it. Use the results parameters to get the count
into a global variable.



--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org








-- Darren Green (SQL Server MVP) DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org

.



Relevant Pages

  • Re: DTS Global Variable
    ... Dejan Sarka, SQL Server MVP ... I have some Global Variable in my package. ... And I execute the ... > from with in a Stored proceure - as I need to pass value to Global ...
    (microsoft.public.sqlserver.programming)
  • Re: Logging within User_Defined Functions (UDF)
    ... >>SQL Server MVP ... >>> I'm trying to carry out some logging each time an UDF ... Ultimately you can only execute ... >>> Only functions and extended stored procedures can be ...
    (microsoft.public.sqlserver.programming)
  • Re: Deadlock incidence greatly increased after upgrade from 11.5.1 to 12.5.3 - Suggestions?
    ... They may not execute simultaneously, but each user process only gets a ... Mike Epprecht, Microsoft SQL Server MVP ... >> Mike Epprecht, Microsoft SQL Server MVP ...
    (comp.databases.sybase)
  • Re: sp_password
    ... SQL Server MVP ... "Leon Parker" wrote in message ... > Whenever I execute the procedure I get the error message that the ...
    (microsoft.public.sqlserver.security)
  • Re: 64bit insert delays
    ... If you execute them in QA using the same QA window, then they are executed synchronously, i.e., the ... Tibor Karaszi, SQL Server MVP ... >> If that takes significant time, then you have some other problem. ... >> Tibor Karaszi, SQL Server MVP ...
    (microsoft.public.sqlserver.programming)