Showing posts with label tsql. Show all posts
Showing posts with label tsql. Show all posts

Monday, March 19, 2012

How to catch io's for tsql execution.

Hi gurus.
I want to catch execution statistics like 'reads', 'execution time' for some
reports.
I know I can run it with 'set statistics io on' but it does not effectively
servers the purpose since output can be truncated from sql agent history.
Or I could achiveve it by calling tsql from command line shell, catching
output and parsing it.
Or I can run profiler and catch statistics to table and than browse this
table.
Is there any more elegant and simple way doing it? I was thinking about
executing it and then being able to find execution statistics in system views.
Thank you for your input.
Gene.
You could set up a server-side trace to a file with a very tight filter of
just the few sprocs you wish to track. The file could be loaded into a
table for historical tracking and analysis.
Kevin G. Boles
TheSQLGuru
Indicium Resources, Inc.
"Gene." <Gene@.discussions.microsoft.com> wrote in message
news:A7D159E0-B654-47F3-8CBE-EB374CA2ADDA@.microsoft.com...
> Hi gurus.
> I want to catch execution statistics like 'reads', 'execution time' for
> some
> reports.
> I know I can run it with 'set statistics io on' but it does not
> effectively
> servers the purpose since output can be truncated from sql agent history.
> Or I could achiveve it by calling tsql from command line shell, catching
> output and parsing it.
> Or I can run profiler and catch statistics to table and than browse this
> table.
> Is there any more elegant and simple way doing it? I was thinking about
> executing it and then being able to find execution statistics in system
> views.
> Thank you for your input.
> Gene.
>

How to catch io's for tsql execution.

Hi gurus.
I want to catch execution statistics like 'reads', 'execution time' for some
reports.
I know I can run it with 'set statistics io on' but it does not effectively
servers the purpose since output can be truncated from sql agent history.
Or I could achiveve it by calling tsql from command line shell, catching
output and parsing it.
Or I can run profiler and catch statistics to table and than browse this
table.
Is there any more elegant and simple way doing it? I was thinking about
executing it and then being able to find execution statistics in system views.
Thank you for your input.
Gene.You could set up a server-side trace to a file with a very tight filter of
just the few sprocs you wish to track. The file could be loaded into a
table for historical tracking and analysis.
--
Kevin G. Boles
TheSQLGuru
Indicium Resources, Inc.
"Gene." <Gene@.discussions.microsoft.com> wrote in message
news:A7D159E0-B654-47F3-8CBE-EB374CA2ADDA@.microsoft.com...
> Hi gurus.
> I want to catch execution statistics like 'reads', 'execution time' for
> some
> reports.
> I know I can run it with 'set statistics io on' but it does not
> effectively
> servers the purpose since output can be truncated from sql agent history.
> Or I could achiveve it by calling tsql from command line shell, catching
> output and parsing it.
> Or I can run profiler and catch statistics to table and than browse this
> table.
> Is there any more elegant and simple way doing it? I was thinking about
> executing it and then being able to find execution statistics in system
> views.
> Thank you for your input.
> Gene.
>

How to catch io's for tsql execution.

Hi gurus.
I want to catch execution statistics like 'reads', 'execution time' for some
reports.
I know I can run it with 'set statistics io on' but it does not effectively
servers the purpose since output can be truncated from sql agent history.
Or I could achiveve it by calling tsql from command line shell, catching
output and parsing it.
Or I can run profiler and catch statistics to table and than browse this
table.
Is there any more elegant and simple way doing it? I was thinking about
executing it and then being able to find execution statistics in system view
s.
Thank you for your input.
Gene.You could set up a server-side trace to a file with a very tight filter of
just the few sprocs you wish to track. The file could be loaded into a
table for historical tracking and analysis.
Kevin G. Boles
TheSQLGuru
Indicium Resources, Inc.
"Gene." <Gene@.discussions.microsoft.com> wrote in message
news:A7D159E0-B654-47F3-8CBE-EB374CA2ADDA@.microsoft.com...
> Hi gurus.
> I want to catch execution statistics like 'reads', 'execution time' for
> some
> reports.
> I know I can run it with 'set statistics io on' but it does not
> effectively
> servers the purpose since output can be truncated from sql agent history.
> Or I could achiveve it by calling tsql from command line shell, catching
> output and parsing it.
> Or I can run profiler and catch statistics to table and than browse this
> table.
> Is there any more elegant and simple way doing it? I was thinking about
> executing it and then being able to find execution statistics in system
> views.
> Thank you for your input.
> Gene.
>

Monday, March 12, 2012

how to call webservice from tsql?

Hello!

From an stored proc I want to call an existing web-service.

How to do that?

Must it be done using CLR-procs or is there some way in TSQL?

Greetings

Bjorn

Are you really need this...

CLR is one of the best way to invoke your web service. But i never tested it.

If you use sql server 2000 then the MSXML2.XMLHTTP object & sp_OACreate sp is one of the solution for this requirement.

|||

Here the sample code,

Declare @.Object as Int;

Declare @.ResponseText as Varchar(8000);

Code Snippet

Exec sp_OACreate 'MSXML2.XMLHTTP', @.Object OUT;

Exec sp_OAMethod @.Object, 'open', NULL, 'get',

'http://www.webservicex.com/stockquote.asmx/GetQuote?symbol=MSFT', --Your Web Service Url (invoked)

'false'

Exec sp_OAMethod @.Object, 'send'

Exec sp_OAMethod @.Object, 'responseText', @.ResponseText OUTPUT

Select @.ResponseText

Exec sp_OADestroy @.Object

|||

Hi!

Sorry not writing, that I'm using SS2005...

Makes this some difference?

/Bjorn

|||

The Query (given below) can be used in both versions...

For SQL Server 2005 you have to enable the "OLE Automation" option.

Start-> Programs - > Microsoft SQL Server 2005 -> Configuration Tools ->SQL Server Surface Area Configuration

Click the link Surface Area Configuration for Features

Expand the DB -> Database Engine

Select OLE Automation & Check the checkbox Enable OLE Automation..

After the settings completed execute the code...

|||

Hi!

I have to use post, but how do I get it to work?

I was told I should look at this:

POST /xyzproxy/alarminsert.asmx HTTP/1.1
Host: 192.168.1.111
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/TestWebService"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlnsTongue Tiedoap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TestWebService xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>

How do I send a request like that using TSQL?

/Bjorn