SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Any way to see or view the results of an execute sql task ?


Any way to see or view the results of an execute sql task ?

Author
Message
below86
below86
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1813 Visits: 2745
Luis Cazares (10/30/2013)
below86 (10/30/2013)
So until someone can tell me how I can see this same type of 'log' information for an execution of a SQL job, I will not be using the execute SQL task.

If you just want to know where and why the task failed, you could use SQL Server error handling to get an even better error log. To avoid changes on the SSIS package, you could simply use Stored Procedures instead of the full query.
I'm not sure that your way is the way to go, but if it works for you, then I can't suggest you to stop using it, just wanted to give some ideas.;-)


I know how to tell where my SSIS package failed it's just finding out where in the SQL it failed and what error it gave. And from what I've done, granted not a lot, I don't see that I can get that detail from the execute SQL task. If you have a 1,000 line SQL file you are executing with say 20 individual SQL 'steps' within it. I need to know that SQL 'step' 10 failed for 'duplicate key' or whatever the error is. My log file will give me that and I can also see how many rows were processed by each step. I haven't done much with stored procedure so I am not aware of any 'log' that is created when it is executed. Where/and how would I find that information? Does the stored procedure need to be set up in any special way for this to happen? Or is is a setting on the database or server?

-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Luis Cazares
Luis Cazares
SSC-Forever
SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)SSC-Forever (43K reputation)

Group: General Forum Members
Points: 43537 Visits: 19861
I wasn't saying that stored procedures save a log automatically, but are a simple way to manage your T-SQL code without touching the SSIS packages.
For the error logging, take a look at TRY...CATCH documentation. It might seem to be more work to do, but it's more flexible than normal logging.


Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
below86
below86
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1813 Visits: 2745
Luis Cazares (10/30/2013)
I wasn't saying that stored procedures save a log automatically, but are a simple way to manage your T-SQL code without touching the SSIS packages.
For the error logging, take a look at TRY...CATCH documentation. It might seem to be more work to do, but it's more flexible than normal logging.


Sorry I miss understood your prior post. I'll keep the TRY..Catch in mind, but with thousands of individual SQL jobs out there it would be a long time to migrate to that. I was just hoping there was something out there that I wasn't aware of. Thanks.

-------------------------------------------------------------
we travel not to escape life but for life not to escape us
blasto_max
blasto_max
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1203 Visits: 480
I am doing only select statements.

Response "to below86" - regarding execute SQL indirectly by executing a bat file which executes SQL - I am trying something similar now. Need your help to figure it out.

I made posts on it here and haven't got much help so far -

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/dbcdd59d-469d-49db-a33e-f554d5f915c3/need-help-to-make-sqlcmd-run-as-per-requirements?forum=sqltools#cbff0250-8809-4708-9eb4-f0622360f887

http://stackoverflow.com/questions/19674377/need-to-understand-output-of-sqlcmd-exe
pnr8uk
pnr8uk
SSC-Addicted
SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)SSC-Addicted (431 reputation)

Group: General Forum Members
Points: 431 Visits: 493
Hi mate, if you are only doing select statments then my solution would work...
below86
below86
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1813 Visits: 2745
We have the following in a bat file:

REM This BAT file uses the userid and password of the account that is running the BAT file.
REM %1 = SQLServer name
REM %2 = database
REM %3 = path to .sql and .log files folder
REM %4 = file name w/o the file extension for .sql and .log files


osql -S %1 -E -d %2 -i "%3%4.sql" -o "%3%4.log" -b

We have another version that requires username and password.

In SSIS we send the 'varaiables' this needs in the Arguments part of the execute process task and the Executable portion points to this bat file.

Let me know if you need more than this.

-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)SSC Guru (65K reputation)

Group: General Forum Members
Points: 65220 Visits: 13298
below86 (10/30/2013)
...
osql -S %1 -E -d %2 -i "%3%4.sql" -o "%3%4.log" -b
...


Just for your information:
osql is deprecated (and it has some issues. I remember it not working with utf8 files are something like that.)
You can replace it with sqlcmd.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
below86
below86
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1813 Visits: 2745
Koen Verbeeck (10/30/2013)
below86 (10/30/2013)
...
osql -S %1 -E -d %2 -i "%3%4.sql" -o "%3%4.log" -b
...


Just for your information:
osql is deprecated (and it has some issues. I remember it not working with utf8 files are something like that.)
You can replace it with sqlcmd.


Thanks for the info, I'll keep it in mind if we start to see issues.

-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search