Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Wednesday, March 28, 2012

How do I launch an agent job from command line?

What is the easiest way to execute a SQL Agent (2005) job from the command line? I need to make a batch file to execute a reporting service shared schedule job.

Thanks in advance.

Refer to Books Online, Topic: 'DTExec utility'

DTExec.exe is the replacement for SQL 2000's DTSRun.exe.

|||Correct me if i'm wrong, but I think DTExec is just used for SSIS packages? I need to run the entire job. The job was generated by Reporting Services and I need to call it manually. Thanks a lot.|||

You're correct. I mis-interpreted your question.

You can use SQLCmd.exe, combined with a call to sp_startJob.

(If you are using SQL 2000, then use OSQL.exe instead of SQLCmd.)

Refer to Books Online for the complete syntax for either.

|||

Thanks a lot, I couldn't get the stored procedure to work but i just used the code that it mentioned in the Job properties window. The exact code for sqlcmd was: sqlcmd -Q "exec ReportServer.dbo.AddEvent @.EventType ='SharedSchedule', @.EventData='0dd48b88-6c35-4f3c-913e-b5299de948db'"

Thanks much.

Wednesday, March 21, 2012

How do I go to line number referenced in SQL error message

I get a SQL error message like:
Server: Msg 7391, Level 16, State 1, Procedure sp_MyProc, Line 205
So I open up the stored proc with sp_helptext and select Edit | GoTo Line
205 in the results pane. Given the error, I would expect to see a linked
server reference on this line. However, I am on BEGIN of an IF statement
block.
How can I relate the actual stored proc line number with the line number
referenced in the error message?It is normally off by one or two lines, but begin counting at the create
proc command, NOT at the beginning of your script which might have (If
exists, drop, etc.)
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Dave" <dave@.nospam.ru> wrote in message
news:ePOQEdTQFHA.2348@.tk2msftngp13.phx.gbl...
> I get a SQL error message like:
> Server: Msg 7391, Level 16, State 1, Procedure sp_MyProc, Line 205
> So I open up the stored proc with sp_helptext and select Edit | GoTo Line
> 205 in the results pane. Given the error, I would expect to see a linked
> server reference on this line. However, I am on BEGIN of an IF statement
> block.
> How can I relate the actual stored proc line number with the line number
> referenced in the error message?
>|||You can use the Debugger in Query Analyzer. Right-click on the SP in
the Object Browser and click Debug.
--
David Portas
SQL Server MVP
--

Monday, March 19, 2012

How do I get rid of this problem

Hi, I did a web page for the intranet where I work using ASP and a database in SQL Server, the connection line is the following:
Set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=sqloledb;Server=zapopan02;database=data;U ser Id=sa"
The problem comes the first time I try to establish the connection after 5 min. (aprox) of inactivity.
I get the following error:
Microsoft OLE DB Provider for SQL Server error '80004005'
Timeout expired
Then, I refresh the page and it works fine (and keeps working until I stop using the page for a while)
Could someone pleaseee tell me how to get rid of this problem?
Thank in advance
-RichardGenerally some sort of problem finding the DSN. Could be lost in the global.asa file, or perhaps this is not a SYSTEM DSN.

May refer to this KBA (http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q169/4/70.asp&NoWebContent=1) about connection pooling FAQ.|||For those who might have the same problem that I did, here is the answer to my own question:
There is a parameter named Connect Timeout wich is 15 seconds by default, that means that if after 15 sec the connection has not been established, oledb returns an error.
So, I changed the connection line to the following:
oConn.Open " Provider=sqloledb;Server=zapopan02;database=data;U
ser Id=sa;Connection Timeout=30"
And it worked, but anyway, I dont feel so satisfied because the problem is not 100% solved, I dont get the error anymore and the page opens but its still slow the first time.
Thanks anyway
- Richard

Monday, March 12, 2012

How do I get decimal set to 2 in a column?

I am getting frustrated that I can't force a column to display .50 or .00
thus allowing numbers (double) to line up properly? now I have units in the
column NEXT to this one so I don't want to apply formatting to all columns
:)
This is a C# form based report if that means anything different in the
answer.
Thanks.Select the textbox that you want to format, right click, go to properties,
select custom format and type N2
"SRussell" wrote:
> I am getting frustrated that I can't force a column to display .50 or .00
> thus allowing numbers (double) to line up properly? now I have units in the
> column NEXT to this one so I don't want to apply formatting to all columns
> :)
> This is a C# form based report if that means anything different in the
> answer.
> Thanks.
>
>|||"Joe" <Joe@.discussions.microsoft.com> wrote in message
news:922D10BD-EE7E-40BD-93FA-7274C71700AE@.microsoft.com...
> Select the textbox that you want to format, right click, go to properties,
> select custom format and type N2
Thanks!