Sunday, March 25, 2012
Can i execute stored procedure from enterprise manager
ThanksI would of initially said no... but where there's a will there's a way.
you could always right click on a table, show top whatever rows, and show the SQL Query, in there try typing the "exec procname" statement. That should work. But if i were you, I'd stick with Query Analyzer.|||For what purpose?
can i execue only some steps in my dts?
Sunday, February 19, 2012
Can A Trigger Be Used to Execute a DTS Package?
have a table called tblBatch which is at the top of my hierarchy, and I have
a field called Validate in that table. And when a user updates its value,
can a trigger be executed to, in turn, execute a DTS package that would run
a bunch of validations?
If, yes, how would the trigger code look that calls tha DTS package?
You could do this by using xp_cmdshell and calling the dtsrun.exe command
prompt utility. But remember that trigger is part of the transaction, which
could become very long if you run a DTS package inside it. Maybe you could
do this asynchronously? Maybe you could just write a custom error in the
Event Log and define an alert on that error, and the alert can call a job
that executes the package?
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Dana Shields" <danashields@.softhome.net> wrote in message
news:Iw3rc.12923$zn.6526@.twister.rdc-kc.rr.com...
> Can a table's trigger be used to launch a dts package? FOr example, if I
> have a table called tblBatch which is at the top of my hierarchy, and I
have
> a field called Validate in that table. And when a user updates its value,
> can a trigger be executed to, in turn, execute a DTS package that would
run
> a bunch of validations?
> If, yes, how would the trigger code look that calls tha DTS package?
>
|||Can this code be used? I don't know a lot about this:
CREATE TRIGGER [triggerRunDTSPackage] ON [dbo].[tblTestName]
FOR UPDATE
AS
declare @.CMD varchar(1000)
declare @.ERROR int
IF UPDATE (ImportMore)
set @.ERROR = 0
-- DTSRun parameters must be reset for any
server/database/password change
set @.CMD = 'DTSRUN.exe /S MyServerName /U MyUserName /P
MyPassword /N TestWizard'
EXECUTE @.ERROR = master..xp_cmdshell @.CMD
The DTS package name is TestWizard and the table/field is
tblTestName.ImportMore
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si > wrote in
message news:uiukVtnPEHA.2580@.TK2MSFTNGP09.phx.gbl...
> You could do this by using xp_cmdshell and calling the dtsrun.exe command
> prompt utility. But remember that trigger is part of the transaction,
which[vbcol=seagreen]
> could become very long if you run a DTS package inside it. Maybe you could
> do this asynchronously? Maybe you could just write a custom error in the
> Event Log and define an alert on that error, and the alert can call a job
> that executes the package?
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "Dana Shields" <danashields@.softhome.net> wrote in message
> news:Iw3rc.12923$zn.6526@.twister.rdc-kc.rr.com...
> have
value,
> run
>
Can A Trigger Be Used to Execute a DTS Package?
have a table called tblBatch which is at the top of my hierarchy, and I have
a field called Validate in that table. And when a user updates its value,
can a trigger be executed to, in turn, execute a DTS package that would run
a bunch of validations?
If, yes, how would the trigger code look that calls tha DTS package?You could do this by using xp_cmdshell and calling the dtsrun.exe command
prompt utility. But remember that trigger is part of the transaction, which
could become very long if you run a DTS package inside it. Maybe you could
do this asynchronously? Maybe you could just write a custom error in the
Event Log and define an alert on that error, and the alert can call a job
that executes the package?
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Dana Shields" <danashields@.softhome.net> wrote in message
news:Iw3rc.12923$zn.6526@.twister.rdc-kc.rr.com...
> Can a table's trigger be used to launch a dts package? FOr example, if I
> have a table called tblBatch which is at the top of my hierarchy, and I
have
> a field called Validate in that table. And when a user updates its value,
> can a trigger be executed to, in turn, execute a DTS package that would
run
> a bunch of validations?
> If, yes, how would the trigger code look that calls tha DTS package?
>|||Can this code be used? I don't know a lot about this:
CREATE TRIGGER [triggerRunDTSPackage] ON [dbo].[tblTestName]
FOR UPDATE
AS
declare @.CMD varchar(1000)
declare @.ERROR int
IF UPDATE (ImportMore)
set @.ERROR = 0
-- DTSRun parameters must be reset for any
server/database/password change
set @.CMD = 'DTSRUN.exe /S MyServerName /U MyUserName /P
MyPassword /N TestWizard'
EXECUTE @.ERROR = master..xp_cmdshell @.CMD
The DTS package name is TestWizard and the table/field is
tblTestName.ImportMore
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:uiukVtnPEHA.2580@.TK2MSFTNGP09.phx.gbl...
> You could do this by using xp_cmdshell and calling the dtsrun.exe command
> prompt utility. But remember that trigger is part of the transaction,
which
> could become very long if you run a DTS package inside it. Maybe you could
> do this asynchronously? Maybe you could just write a custom error in the
> Event Log and define an alert on that error, and the alert can call a job
> that executes the package?
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "Dana Shields" <danashields@.softhome.net> wrote in message
> news:Iw3rc.12923$zn.6526@.twister.rdc-kc.rr.com...
> have
value,[vbcol=seagreen]
> run
>
Can A Trigger Be Used to Execute a DTS Package?
have a table called tblBatch which is at the top of my hierarchy, and I have
a field called Validate in that table. And when a user updates its value,
can a trigger be executed to, in turn, execute a DTS package that would run
a bunch of validations?
If, yes, how would the trigger code look that calls tha DTS package?You could do this by using xp_cmdshell and calling the dtsrun.exe command
prompt utility. But remember that trigger is part of the transaction, which
could become very long if you run a DTS package inside it. Maybe you could
do this asynchronously? Maybe you could just write a custom error in the
Event Log and define an alert on that error, and the alert can call a job
that executes the package?
--
Dejan Sarka, SQL Server MVP
Associate Mentor
Solid Quality Learning
More than just Training
www.SolidQualityLearning.com
"Dana Shields" <danashields@.softhome.net> wrote in message
news:Iw3rc.12923$zn.6526@.twister.rdc-kc.rr.com...
> Can a table's trigger be used to launch a dts package? FOr example, if I
> have a table called tblBatch which is at the top of my hierarchy, and I
have
> a field called Validate in that table. And when a user updates its value,
> can a trigger be executed to, in turn, execute a DTS package that would
run
> a bunch of validations?
> If, yes, how would the trigger code look that calls tha DTS package?
>|||Can this code be used? I don't know a lot about this:
CREATE TRIGGER [triggerRunDTSPackage] ON [dbo].[tblTestName]
FOR UPDATE
AS
declare @.CMD varchar(1000)
declare @.ERROR int
IF UPDATE (ImportMore)
set @.ERROR = 0
-- DTSRun parameters must be reset for any
server/database/password change
set @.CMD = 'DTSRUN.exe /S MyServerName /U MyUserName /P
MyPassword /N TestWizard'
EXECUTE @.ERROR = master..xp_cmdshell @.CMD
The DTS package name is TestWizard and the table/field is
tblTestName.ImportMore
"Dejan Sarka" <dejan_please_reply_to_newsgroups.sarka@.avtenta.si> wrote in
message news:uiukVtnPEHA.2580@.TK2MSFTNGP09.phx.gbl...
> You could do this by using xp_cmdshell and calling the dtsrun.exe command
> prompt utility. But remember that trigger is part of the transaction,
which
> could become very long if you run a DTS package inside it. Maybe you could
> do this asynchronously? Maybe you could just write a custom error in the
> Event Log and define an alert on that error, and the alert can call a job
> that executes the package?
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
> Solid Quality Learning
> More than just Training
> www.SolidQualityLearning.com
> "Dana Shields" <danashields@.softhome.net> wrote in message
> news:Iw3rc.12923$zn.6526@.twister.rdc-kc.rr.com...
> > Can a table's trigger be used to launch a dts package? FOr example, if I
> > have a table called tblBatch which is at the top of my hierarchy, and I
> have
> > a field called Validate in that table. And when a user updates its
value,
> > can a trigger be executed to, in turn, execute a DTS package that would
> run
> > a bunch of validations?
> >
> > If, yes, how would the trigger code look that calls tha DTS package?
> >
> >
>
Sunday, February 12, 2012
calling XACT_ABORT before/after BEGIN TRAN... What's the difference?
Is it necessary to execute "SET XACT_ABORT ON" before "BEGIN TRANSACTION"?
I have tried to call "SET XACT_ABORT ON" after "BEGIN TRANSACTION" and it works fine over a distributed transaction which includes a linked server.
XACT_ABORT is used to control the flow the current transaction.
If it is ON the Entire Transaction will be rollbacked and the Transaction Batch will be terminated immediately.
If it is OFF when the runtime error the current statement only rollbacked and the transaction batch will be executed with out any termination.
It is up to you what kind of behavior you need on your transaction.
But as per the Books online they are not recommending to use this option on Distributed Transactions.
See more on Books Online Under SET XACT_ABORT.
Friday, February 10, 2012
Calling vb script from SQL job
e
this as a scheduled task and then use a separate SQL job to compelte the
formatting tasks, but prefer to keep all steps consolidated so it is easier
to trouble shoot.
I tried using xp_cmdshell 'job.vbs', no_output
but it gives the error that this is not a recognized internal command.
Any help would be greatly appreciated.>I am trying to execute a visual basic script using a SQL job. I can
>schedule
> this as a scheduled task and then use a separate SQL job to compelte the
> formatting tasks,
Why don't you have the VBScript task call a stored procedure?
A|||Hello Derekman:
You wrote on Mon, 26 Jun 2006 12:12:03 -0700:
D> I am trying to execute a visual basic script using a SQL job. I can
D> schedule this as a scheduled task and then use a separate SQL job to
D> compelte the formatting tasks, but prefer to keep all steps consolidated
D> so it is easier to trouble shoot.
D> I tried using xp_cmdshell 'job.vbs', no_output
D> but it gives the error that this is not a recognized internal command.
You can run only an executable; sql server won't look into the registry to
see what is the application handling file extension. In Explorer, this is
most likely specified as
WScript.exe "%1" %*
That's how it should be in sql job as well.
Vadim Rapp