Showing posts with label step. Show all posts
Showing posts with label step. Show all posts

Thursday, March 29, 2012

Getting a step in a job to start another job in another database...

Hi, can anyone help me by telling me how to get a step in
a job to start another job in another database please...'
Cheers,
NikThere are no jobs at the database level. Did you mean, starting a job on
another server?
All you need is the job name, and pass it to msdb..sp_start_job. If the job
is on a different server, then you could add a linked server to that server
and call ServerName.msdb..sp_start_job
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"nik" <nik.hall@.deletethisalstons.co.uk> wrote in message
news:888301c3e97e$79aa7070$a501280a@.phx.gbl...
Hi, can anyone help me by telling me how to get a step in
a job to start another job in another database please...'
Cheers,
Nik|||Spot on thanks. Its a job on another server that I am
trying to start. I have taken a look at books online to
see the syntax, might give you another shout here if I get
stuck!
Thanks a bunch,
Nik
quote:

>--Original Message--
>There are no jobs at the database level. Did you mean,

starting a job on
quote:

>another server?
>All you need is the job name, and pass it to

msdb..sp_start_job. If the job
quote:

>is on a different server, then you could add a linked

server to that server
quote:

>and call ServerName.msdb..sp_start_job
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>"nik" <nik.hall@.deletethisalstons.co.uk> wrote in message
>news:888301c3e97e$79aa7070$a501280a@.phx.gbl...
>Hi, can anyone help me by telling me how to get a step in
>a job to start another job in another database please...'
>Cheers,
>Nik
>
>.
>

Getting a step in a job to start another job in another database...

Hi, can anyone help me by telling me how to get a step in
a job to start another job in another database please...'
Cheers,
NikThere are no jobs at the database level. Did you mean, starting a job on
another server?
All you need is the job name, and pass it to msdb..sp_start_job. If the job
is on a different server, then you could add a linked server to that server
and call ServerName.msdb..sp_start_job
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"nik" <nik.hall@.deletethisalstons.co.uk> wrote in message
news:888301c3e97e$79aa7070$a501280a@.phx.gbl...
Hi, can anyone help me by telling me how to get a step in
a job to start another job in another database please...'
Cheers,
Nik|||Spot on thanks. Its a job on another server that I am
trying to start. I have taken a look at books online to
see the syntax, might give you another shout here if I get
stuck!
Thanks a bunch,
Nik
>--Original Message--
>There are no jobs at the database level. Did you mean,
starting a job on
>another server?
>All you need is the job name, and pass it to
msdb..sp_start_job. If the job
>is on a different server, then you could add a linked
server to that server
>and call ServerName.msdb..sp_start_job
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>"nik" <nik.hall@.deletethisalstons.co.uk> wrote in message
>news:888301c3e97e$79aa7070$a501280a@.phx.gbl...
>Hi, can anyone help me by telling me how to get a step in
>a job to start another job in another database please...'
>Cheers,
>Nik
>
>.
>

Friday, March 9, 2012

get the error message in scheduled task

Hello,
Is there a way to get the error message in a scheduled task?
I've a backup scheduled with two steps. The first step is the backup
procedure and the second step is a t-sql code which fires an email to
the backup operator.
How can i set the error in the email message if the schedule fails?
ThnxJust a quick thought. If you have both the backup and the emailing code in
the same step, may be you could capture the @.@.ERROR variable after the
backup completes/fails. If @.@.ERROR is not 0, then you know you have an
error.
The way I deal with this is, using Microsoft Operations Manager. You can get
this to email you when a job fails.
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Jason" <jasonlewis@.hotrmail.com> wrote in message
news:uSlWOlbkFHA.3316@.TK2MSFTNGP14.phx.gbl...
Hello,
Is there a way to get the error message in a scheduled task?
I've a backup scheduled with two steps. The first step is the backup
procedure and the second step is a t-sql code which fires an email to
the backup operator.
How can i set the error in the email message if the schedule fails?
Thnx|||I find it easiest to define an output file for the first job step and includ
e that output file in
the emailing step.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jason" <jasonlewis@.hotrmail.com> wrote in message news:uSlWOlbkFHA.3316@.TK2MSFTNGP14.phx.g
bl...
> Hello,
> Is there a way to get the error message in a scheduled task?
> I've a backup scheduled with two steps. The first step is the backup proce
dure and the second step
> is a t-sql code which fires an email to the backup operator.
> How can i set the error in the email message if the schedule fails?
> Thnx

Friday, February 24, 2012

get records after executing a stored procedure

Hi All,

I have a Execute SQL Task I get some values from a table onto three variables. Next step in a DFT, I try to execute a stored proc by passing these variables as parameters.

EXEC [dbo].[ETLloadGROUPS]
@.countRun =?,
@.startTime =?,
@.endTime = ?

This is the syntax i use, in the parameters tab of the DFT I ensured that all the parameters are correctly mapped.

When I run the package, it executes successfully but no rows are fectched. I tried running the stored proc manually in the database, and it seems to work fine.

Am I missing something here ? Please Advice

Thanks in Advance

I am sure it is a type issue. SSIS has a VERY VERY irritating feature of not telling you it can't convert your var to the SQL type you set in the parameters section, it just ignores it and sets it to nothing.

Try setting your vars to "String" types and your parameters in the task to "VARCHAR". I bet it will work.

You might also try setting vars inside the SQL to the ?. I have had issues where it doesn't like ? in certain places.

DECLARE @.count INT, @.stime datetime, @.etime datetime
SET @.count = ?
SET @.stime = ?
SET @.etime = ?

EXEC [dbo].[ETLloadGROUPS]
@.countRun =@.count,
@.startTime =@.stime,
@.endTime = @.etime|||

Tom,

Thanks for the quick response. but guess am into a soup here... I have done the following in the parameters tab of the Execute SQL Task.

varName Direction Datatype ParaName

user::countRun Input varchar 0

user:endDate input varchar 1

user:runDate Input varchar 2

In the result set , I have done the following,

Result Name variable Name

0 user::countRun

1 user:endDate

2 user:runDate

al the three variables are of the datatype String.

when I execute the package its now failing with the error, the type of the value assigned to the variable differs from the current datatype. I guess the values from the table which are int and date are not accepted in this parameter mapping. How to handle this?

Thanks for the help so far

|||It sounds like you don't have dates in the strings. What are the values of the parameters you are passing.

Try this:

SET @.count = CAST(? AS INT)
SET @.stime = CAST(? AS DATETIME)
SET @.etime = CAST(? AS DATETIME)

You could run the SQL Profiler and capture exactly the command it is running.

|||

When you say "no rows are fetched" how are you determining this?

what are you doing with the results of the sqltask?

|||

Hi Jeff,

My whole idea is to query a table, get three values onto three variables, pass these values to a stored procedure and then get the entire set of records returned by the proc and then insert it to another OLE DB Destination.

|||

Tom Phillips wrote:

It sounds like you don't have dates in the strings. What are the values of the parameters you are passing.

Try this:

SET @.count = CAST(? AS INT)
SET @.stime = CAST(? AS DATETIME)
SET @.etime = CAST(? AS DATETIME)

You could run the SQL Profiler and capture exactly the command it is running.

I am selecting all the three values from a table and then passing them to a stored procedure.

|||

Hi All,

I have solved all the issues, now at the last summit though its giving me an error with the OLE DB Source component where am calling the stored proc. The erorr is, A rowset based on the SQL Command was not returned by the OLE DB Provider.

Any idea to resolve this ?

Thanks in advance.

|||adding "SET NOCOUNT ON" at the start of the stored proc resolved the issue. Thx for all the help :)

Get Previous step result in an SSIS Script Task

Hello,

I am using SQL Server 2005 Integration Services to create new values for my tables. One step I must do is execute a query and the script task that receive its constraint (it is set to completion) must do different things depending on the query result.

My question is: how can I know the result of the precedence constraint?

Thank you,

Pablo Orte

If a task executes then it matched your precedence constraint. If you say "Complete" and "VarA == 20", and it executes then you can be assured that was the result. Are you wanting to do branching, or have multiple precedent constraints?|||

The key point to what I think Sean is suggesting, is that if you can get a variable to hold the result, you could use an expression to influence the constraint, whether it is satisfied or not. Expression support on a constraint is very useful for influencing workflow.

I am not sure that this is useful to you, since you have to populate that variable somehow. One way would be to use an on error event handler on the task. Default the variable to true, and change it to false in the event handler.

I don't know why or exactly what you are trying to do, but my first reaction would be this sounds like a bad idea. I think there should be a better, more SSIS way of trying to achieve this. Forgive me, but your method reminds me of the hacks we used in DTS. To conditionally do something why not use two tasks, or why not use event handlers to do an out of band type operation when something fails.

|||

This thread might have somthing for you...

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=859001&SiteID=1

Rafael Salas

|||

Hi and thanks for your replies,

The problem I have is that I have to do this in a script task situated after an "Execute SQL". This cannot return any parameter and I need to have something in the code like this

IF objDTSPackage.Steps("DTSStep_DTSExecuteSQLTask_1").ExecutionResult = 0 THEN

This code worked in SQL Server 2000, but not in SQL Server 2005.

Thanks,

Pablo Orte