Showing posts with label capturing. Show all posts
Showing posts with label capturing. Show all posts

Saturday, February 25, 2012

Capturing XML

Ok, this is a broad question. Our system is going to receive xml files from vendors that contain background check results for individuals. We want to capture the xml results in the db for historical purposes and to have a copy of what the vendor sent before we translated the results and updated our system. I was going to store the xml in a table with a text column but wasn't sure if there was a better way to do this. Anyone have any suggestions?

ThanksI think there have a couple of posts recently on this very subject. I think the general consensus is to store the XML in an NText or Text column. Individual contributors have cautioned that these column types require additional "attention" in the form of more frequently scheduled DBCC CHECKDB statements. That has not been my experience, but others have suggested it.

Certainly in your case, since you want to keep a copy of the data received prior to manipulating it, storing it "as-is" is probably a good idea. An alternative might be to store the filename (as a pointer) in the database while saving the XML to a file on either the database server or some other location.

Regards,

hmscott|||Well, you're going to need to use the data too, right?

DECLARE @.xml varchar(1000)

SET @.xml = '<?xml version="1.0" encoding="ISO-8859-1"?>
<InsertSessionData>
<Input>
<SessionID>6F9619FF-8B86-D011-B42D-0C04FC964FF</SessionID>
<Last_Accessed>20030101</Last_Accessed>
<State><somexml></somexml></State>
</Input>
</InsertSessionData>'

DECLARE @.idoc int

EXEC sp_xml_preparedocument @.idoc OUTPUT, @.xml

SELECT * FROM OPENXML(@.idoc, '/InsertSessionData/Input', 2)
WITH(
SessionID varchar(8000),
Last_Accessed Datetime,
State Text
)|||Brett,

Your point is well taken. However, there are other ways of getting at the data in the documents. We use a VBScript and the MS DOM to strip out the necessary data and store it in the relational tables. We don't keep a copy of the XML docs (no requirement to do so), but if I did, I could simply add a line to insert the text into an archive table for historical purposes.

But I don't use OPENXML to parse the XML itself.

Regards,

hmscott|||Thanks for the ideas. We're going to extract the data we need through java code. The table is strictly for archiving. Kind of an insurance policy if we have problems with our interface application.

Capturing WARNINGS to write to error log?

Hey y'all...

Anyone know how to capture SQL Warnings so I can write them to an error log? I can't seem to find any info on it in Books Online...

I can capture the errors just fine by using @.@.ERROR after a select, but what about warnings such as "Warning: Null value is eliminated by an aggregate or other SET operation."

Thanks!IF (EXISTS (SELECT name FROM msdb.dbo.sysalerts WHERE name = 'NULL_VALUE'))
EXECUTE msdb.dbo.sp_delete_alert @.name = N'NULL_VALUE'
EXECUTE msdb.dbo.sp_add_alert @.name = N'NULL_VALUE', @.message_id = 8153, @.severity = 0, @.enabled = 1, @.delay_between_responses = 60, @.include_event_description_in = 4, @.category_name = N'[Uncategorized]'|||Warnings get returned as messages in the TDS stream, much like PRINT statements do. I don't think that they generate an internal event or change any spid state information, so I don't think that there is any way for a script/stored procedure to capture them.

I'm pretty sure that you can modify the client to capture warning messages and the text (after substitution) of error messages, but I can't think of any way to capture it on the server side.

-PatP|||Pat, do me a favor and replicate on your TEST system the following screens. I saved the actual error message screens, but before posting this also experimented with warnings that you called "like PRINT statements." So that there won't be any further confusion, anything that is stored in sysmessages can be logged to the errorlog of both SQL Server and Windows Application log, as long as the check box in screen #3 is checked.|||Will do, but it will be a couple of days before I have the opportunity. I'm traveling now, and when I get back to the orifice I'll be working on other issues for a couple of days. It will probably be 2004-07-29 before I really have a chance to try it.

-PatP

Capturing value of identity column for use later?

This doesn't work because the first INSERT is creating multiple
records for multiple projects. @.@.IDENTITY, then, contains the Identity
column value for the last tblWeekReportedLine record inserted.

Consequently, all the hours records are then associated with
that last value.

The source work table, #EstimateLines, is a pivoted representation
with a Begin/End date and some Hours for each of six periods - a line
per project that gets pushed up to the DB by some VB code.
Definition below the sample coding.

The "@.WeekReportedID" value was successfully captured when
previous coding inserted six records into that table: one for
each date range (i.e. column in the UI screen)

Sounds like I'm approaching this wrong.

Suggestions on the right way to go about it?

-------
INSERT INTO tblWeekReportedLine
(
WeekReportedID,
RelativeLineNumber,
ProjectID
)
SELECT
@.WeekReportedID1,
#EstimateLines.RelativeLineNumber,
#EstimateLines.ProjectID
FROM#EstimateLines;

SET@.CurWeekReportedLineID = @.@.IDENTITY;

INSERT INTO tblHour
(
WeekReportedID,
WeekReportedLineID,
HoursDate,
Hours,
HoursTypeID,
HoursType,
TaxCodeID,
TaxCode
)
SELECT
@.WeekReportedID1,
@.CurWeekReportedLineID,
@.BeginDate1,
Estimate1,
@.DummyHoursTypeID,
@.DummyHoursType,
@.DummyTaxCodeID,
@.DummyTaxCode
FROM#EstimateLines;
--------

The #Temp table create via VB:
--------

1030 .CommandText = "CREATE TABLE #EstimateLines " & _
" ( " & _
" PersonID int, " & _
" ProjectID int, " & _
" RelativeLineNumber int, " & _
" Available1 decimal(5,2) Default 0, Estimate1
decimal(5,2) Default 0, BeginDate1 DateTime, EndDate1 DateTime, " & _
" Available2 decimal(5,2) Default 0, Estimate2
decimal(5,2) Default 0, BeginDate2 DateTime, EndDate2 DateTime, " & _
" Available3 decimal(5,2) Default 0, Estimate3
decimal(5,2) Default 0, BeginDate3 DateTime, EndDate3 DateTime, " & _
" Available4 decimal(5,2) Default 0, Estimate4
decimal(5,2) Default 0, BeginDate4 DateTime, EndDate4 DateTime, " & _
" Available5 decimal(5,2) Default 0, Estimate5
decimal(5,2) Default 0, BeginDate5 DateTime, EndDate5 DateTime, " & _
" Available6 decimal(5,2) Default 0, Estimate6
decimal(5,2) Default 0, BeginDate6 DateTime, EndDate6 DateTime, " & _
" );"
--------

--
PeteCresswell"(Pete Cresswell)" <x@.y.z> wrote in message
news:dhmtov0kgau16c4opg7ktc2d69agtieh0t@.4ax.com...
> This doesn't work because the first INSERT is creating multiple
> records for multiple projects. @.@.IDENTITY, then, contains the Identity
> column value for the last tblWeekReportedLine record inserted.
> Consequently, all the hours records are then associated with
> that last value.

<snip
Without full DDL (including keys) and knowing how you populate your
variables, this is a guess, but it may be along the right lines - you can
join onto the tblWeekReportedLine table to get the identity values:

INSERT INTO tblHour
(
WeekReportedID,
WeekReportedLineID,
HoursDate,
Hours,
HoursTypeID,
HoursType,
TaxCodeID,
TaxCode
)
SELECT
w.WeekReportedID,
w.IdentityColumn,
@.BeginDate1,
e.Estimate1,
@.DummyHoursTypeID,
@.DummyHoursType,
@.DummyTaxCodeID,
@.DummyTaxCode
FROM #EstimateLines e
join tblWeekReportedLine w
on e.ProjectID = w.ProjectID and
e.RelativeLineNumber = w.RelativeLineNumber
WHERE w.WeekReportedID = @.WeekReportedID1;

Simon|||RE/
>this is a guess,

Pretty good guess!

I'm still an SQL novice, and haven't learned to stop thinking sequential
processing yet...

Thanks. I may make my Monday deadline yet....

--
PeteCresswell

Capturing the results from exec command

Hi,

I'm writing a small query where I have a dynamic table name and dynamic condition for the criteria. In order to execute this, I need Exec command.

exec(select count(*) from @.dynamictable where condition = @.dynamiccond)

But here I want to capture the count from the select statement. Could any of you help me capture the results from exec command?

Thanks

2 ways

USE pubs
GO

--sp_executesql
DECLARE @.chvTableName VARCHAR(100),
@.intTableCount INT,
@.chvSQL NVARCHAR(100)

SELECT @.chvTableName = 'Authors'
SELECT @.chvSQL = N'SELECT @.intTableCount = COUNT(*) FROM ' + @.chvTableName

EXEC sp_executesql @.chvSQL, N'@.intTableCount INT OUTPUT', @.intTableCount OUTPUT

SELECT @.intTableCount
GO

--EXEC (SQL)
DECLARE @.chvTableName VARCHAR(100),
@.intTableCount INT,
@.chvSQL NVARCHAR(100)

CREATE TABLE #temp (Totalcount INT)
SELECT @.chvTableName = 'Authors'
SELECT @.chvSQL = 'Insert into #temp Select Count(*) from ' + @.chvTableName

EXEC( @.chvSQL)

SELECT @.intTableCount = Totalcount from #temp

SELECT @.intTableCount

DROP TABLE #temp

Denis the SQL Menace

http://sqlservercode.blogspot.com/


|||

Or:

DECLARE @.chvTableName VARCHAR(100)

CREATE TABLE #temp (Totalcount INT)
SELECT @.chvTableName = 'sysobjects'

insert into #temp(totalCount)
EXEC( 'Select Count(*) from ' + @.chvTableName)

SELECT * from #temp

DROP TABLE #temp

Note: it is generally considered a bad practice to do this sort of thing unless you are building some sort of tool. If this is a production application, it would be better to build a procedure per table:

create procedures count_accounts
as
select count(*) from account
go

Yes, it sounds like a lot of maintenance, but unless you build a large quantity of tables, it shouldn't be a big deal.

Capturing the output from store procedure and use it

How do I call capture the output (not return value) from calling a store procedure from within a store procedure so I can use that data for further processing (say join it with another table)?

For example,

CREATE PROCEDURE dbo.sp_test AS
-- returns all words not in Mastery Level 0

EXEC sp_anothertest

-- use the data coming back from sp_test and join it with another table here and say insert them into tblFinalResults

SELECT * tblFinalResults
GO

Thanks!I do not think you can do this exactly as you would like. You may need to resort to either a UDF which returns a table, using table variables within the stored procedure, or using temporary tables. Functions are the most flexiable and temporary tables are the slowest. You can also use table variables as output parameters of the stored procedures. Below is an example of using table variables.
begin
DECLARE @.Result1 table (key1 int, foo varchar(32) )
insert into @.Result1 select 1, 'This is Table 1'

DECLARE @.Result2 table ( key2 int, foo varchar(32) )
insert into @.Result2 select 1, 'This is Table 2'

select * from @.Result1 inner join @.Result2 on( key1 = key2 )
end

capturing the output from a stored procedure into a report

I have a stored procedure that takes some parameters. I can execute it
in the data tab in vb.net and get my results. How do i take these
results and form a report? Is there a way to capture the fields that
are returned in order to drop them into a report?
I'm doing all this in vb.net.
Thanks.Are you using the report designer and the data tab? Does the stored
procedure execute and return data from the data tab? If so, sometimes
executing the stored procedure does not fill the field list. Try clicking on
the refresh fields button (look to the right of the ... , it looks like the
fresh button for IE. Hover over it and it will tell you what the button is
for). If this doesn't cause the field list to fill in then you can put in
the fields manually in the list. Right mouse click in the field list, add
field and give it the name of the field name.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"muris" <rmuris@.hotmail.com> wrote in message
news:1112374203.464263.41490@.z14g2000cwz.googlegroups.com...
> I have a stored procedure that takes some parameters. I can execute it
> in the data tab in vb.net and get my results. How do i take these
> results and form a report? Is there a way to capture the fields that
> are returned in order to drop them into a report?
> I'm doing all this in vb.net.
> Thanks.
>|||hitting the refresh button worked!! Thank you.

Capturing the Error Description in a stored procedure

Hi,

I have a few stored procedure which will be executed one after another. If any error occurs, i need capture the Error number and ERROR DESCRIPTION and SAVE it into a table within stored procedure itself. Any idea how to do it?

I saw a similar problem from http://www.sqlservercentral.com/columnists/ajethva/capturingtheerrordescriptioninastoredprocedure.asp but i cannot download the sample code.

i want to CAPTURE the following msg :

e.g. Server: Msg 547, Level 16, State 1, Line 1
DELETE statement conflicted with COLUMN REFERENCE constraint 'FK__titleauth__au_id__0519C6AF'.
The conflict occurred in database 'pubs', table 'titleauthor', column 'au_id'.

It would be great if you could send sample code.

thanks.

rama

If you use SQL server 2000, you can use the following batch. But you can’t suppers the error message.

Code Snippet

Create table ErrorLog

(

Source nvarchar(100),

CalledUser varchar(100),

ErrorNumber int,

ErrorDescription nvarchar(2000),

ErrorDatetime datetime

)

Go

Create proc MyProc

@.I as int

as

Declare @.Error as int

Select 1/@.I

Set @.Error = @.@.ERROR

If @.Error <> 0

Begin

Insert Into ErrorLog

select

object_name(@.@.PROCID),

suser_sname(),

@.Error,

description,

getdate()

from

Sysmessages

Where

error=@.Error

and msglangid = (select msglangid from syslanguages where name='us_english') -- You can change to your local language

End

Go

Exec MyProc 1

Go

Exec MyProc 0

Go

select * from ErrorLog

Capturing stored procedures parameters

Is it possible to capture, via trace or other means, the value of the
parameters passed to a stored procedure? There is a stored procedure in the
SharePoint database I want to monitor, but I don't want to change it. I want
to know when it's called and what parameters were passed to it.
Thank you in advance,
Daniel
This can easily be done using SQL Profiler. Just establish a new trace
using one of the SQLProfilerTSQL_xxxx templates. If you are only looking to
trace a single procedure, then you should probably play with the filter
criteria to eliminate some of the background noise otherwise you'll need to
wade through all of the TSQL commands being executed.
--Brian
(Please reply to the newsgroups only.)
"Daniel Corra" <daniel.correa@.e-component.com> wrote in message
news:esZKlWeoFHA.1948@.TK2MSFTNGP12.phx.gbl...
> Is it possible to capture, via trace or other means, the value of the
> parameters passed to a stored procedure? There is a stored procedure in
> the SharePoint database I want to monitor, but I don't want to change it.
> I want to know when it's called and what parameters were passed to it.
> Thank you in advance,
> Daniel
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!
Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>
|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>
|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!
Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>
|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>
|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>

Capturing stored proc names in profiler

Hello,
I was wondering if anyone had some insight into my problem.
I'm running a trace and I want to generate a report to show some simple
statistics about the duration, reads, and writes for the stored procedures
in my database. I'm having trouble parsing the stored procedure name from
the TextData field. The RPC:Completed event gives me everything I need for
the statistics, but it doesn't give me the stored procedure name or object
id. I does, however, give me full command, but I have to parse this with
string manipulation which is not quick. The SP:Completed event gives me the
object id of the stored procedure, but non of the statistics. My trace
files are very large and I'm looking for an easy way to generate some
statistics.
Thanks!Hi
I assume that you are loading these into a table for analysis, therefore if
you create a new column for the procedure name (and the procedures have a
recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
textdate, then you can use substring and charindex to update the new column.
When you select the data from the table you can restrict the events
returned.
John
"Oliwa" <abc> wrote in message
news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I was wondering if anyone had some insight into my problem.
> I'm running a trace and I want to generate a report to show some simple
> statistics about the duration, reads, and writes for the stored procedures
> in my database. I'm having trouble parsing the stored procedure name from
> the TextData field. The RPC:Completed event gives me everything I need
> for the statistics, but it doesn't give me the stored procedure name or
> object id. I does, however, give me full command, but I have to parse
> this with string manipulation which is not quick. The SP:Completed event
> gives me the object id of the stored procedure, but non of the statistics.
> My trace files are very large and I'm looking for an easy way to generate
> some statistics.
> Thanks!
>|||Hey John,
That's an idea, but I'm doing something very similar with string
manipulation. I was looking for methods that didn't require string
manipulation.
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
> Hi
> I assume that you are loading these into a table for analysis, therefore
> if you create a new column for the procedure name (and the procedures have
> a recognisable prefix e.g 'prc_ ' in the first 8000 characters of the
> textdate, then you can use substring and charindex to update the new
> column.
> When you select the data from the table you can restrict the events
> returned.
> John
>
> "Oliwa" <abc> wrote in message
> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>> Hello,
>> I was wondering if anyone had some insight into my problem.
>> I'm running a trace and I want to generate a report to show some simple
>> statistics about the duration, reads, and writes for the stored
>> procedures in my database. I'm having trouble parsing the stored
>> procedure name from the TextData field. The RPC:Completed event gives me
>> everything I need for the statistics, but it doesn't give me the stored
>> procedure name or object id. I does, however, give me full command, but
>> I have to parse this with string manipulation which is not quick. The
>> SP:Completed event gives me the object id of the stored procedure, but
>> non of the statistics. My trace files are very large and I'm looking for
>> an easy way to generate some statistics.
>> Thanks!
>|||Hi
If you are only profiling a single user then you can always check your
object ID from the previous SP:Completed event. Even if not a single user,
then you should be able to match SIDs.
When moving the profile into a table, Profiler will generate a RowNumber
Identity column for you.
John
"Oliwa" <abc> wrote in message news:OGJDUB0JFHA.2648@.TK2MSFTNGP14.phx.gbl...
> Hey John,
> That's an idea, but I'm doing something very similar with string
> manipulation. I was looking for methods that didn't require string
> manipulation.
> Thanks
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:%23rCtG6zJFHA.3336@.TK2MSFTNGP09.phx.gbl...
>> Hi
>> I assume that you are loading these into a table for analysis, therefore
>> if you create a new column for the procedure name (and the procedures
>> have a recognisable prefix e.g 'prc_ ' in the first 8000 characters of
>> the textdate, then you can use substring and charindex to update the new
>> column.
>> When you select the data from the table you can restrict the events
>> returned.
>> John
>>
>> "Oliwa" <abc> wrote in message
>> news:%23qbnElyJFHA.2576@.TK2MSFTNGP15.phx.gbl...
>> Hello,
>> I was wondering if anyone had some insight into my problem.
>> I'm running a trace and I want to generate a report to show some simple
>> statistics about the duration, reads, and writes for the stored
>> procedures in my database. I'm having trouble parsing the stored
>> procedure name from the TextData field. The RPC:Completed event gives
>> me everything I need for the statistics, but it doesn't give me the
>> stored procedure name or object id. I does, however, give me full
>> command, but I have to parse this with string manipulation which is not
>> quick. The SP:Completed event gives me the object id of the stored
>> procedure, but non of the statistics. My trace files are very large and
>> I'm looking for an easy way to generate some statistics.
>> Thanks!
>>
>

Capturing SQL Statements?

Hi.
I need to be able to identify which SQL Statements are the poorest
performing so that the application developers can improve them. I've setup
Profiler to trace the login names that I want, but it only captures the first
255 characters of the SQL Statement. Is there anyway to capture all of the
SQL that is being executed?
Thanks!
Susan
It can capture the entire text. My guess is that you are viewing the results
in Query Analyzer which has the default visible column length set to 255.
You should be able to change this via the options menu.
Anith
|||On Mon, 5 Feb 2007 09:01:01 -0800, Susan Cooper
<SusanCooper@.discussions.microsoft.com> wrote:
>I need to be able to identify which SQL Statements are the poorest
>performing so that the application developers can improve them. I've setup
>Profiler to trace the login names that I want, but it only captures the first
>255 characters of the SQL Statement. Is there anyway to capture all of the
>SQL that is being executed?
It's all there.
Save it to a database table and it's a text field, you can access it
with substring().
J.

Capturing SQL Statements?

Hi.
I need to be able to identify which SQL Statements are the poorest
performing so that the application developers can improve them. I've setup
Profiler to trace the login names that I want, but it only captures the first
255 characters of the SQL Statement. Is there anyway to capture all of the
SQL that is being executed?
Thanks!
SusanIt can capture the entire text. My guess is that you are viewing the results
in Query Analyzer which has the default visible column length set to 255.
You should be able to change this via the options menu.
--
Anith|||On Mon, 5 Feb 2007 09:01:01 -0800, Susan Cooper
<SusanCooper@.discussions.microsoft.com> wrote:
>I need to be able to identify which SQL Statements are the poorest
>performing so that the application developers can improve them. I've setup
>Profiler to trace the login names that I want, but it only captures the first
>255 characters of the SQL Statement. Is there anyway to capture all of the
>SQL that is being executed?
It's all there.
Save it to a database table and it's a text field, you can access it
with substring().
J.

Capturing SQL Statements?

Hi.
I need to be able to identify which SQL Statements are the poorest
performing so that the application developers can improve them. I've setup
Profiler to trace the login names that I want, but it only captures the firs
t
255 characters of the SQL Statement. Is there anyway to capture all of the
SQL that is being executed?
Thanks!
SusanIt can capture the entire text. My guess is that you are viewing the results
in Query Analyzer which has the default visible column length set to 255.
You should be able to change this via the options menu.
Anith|||On Mon, 5 Feb 2007 09:01:01 -0800, Susan Cooper
<SusanCooper@.discussions.microsoft.com> wrote:
>I need to be able to identify which SQL Statements are the poorest
>performing so that the application developers can improve them. I've setup
>Profiler to trace the login names that I want, but it only captures the fir
st
>255 characters of the SQL Statement. Is there anyway to capture all of the
>SQL that is being executed?
It's all there.
Save it to a database table and it's a text field, you can access it
with substring().
J.

Capturing SQL noise word exception...

Hi All,

I have a requirement where I need to find the list of noise words from a set of words in a SP.

PS: Too common words are said to be noise words and SQL maintains list of noise words on its own.

Say I have a sentence like "I am a software engineer. Here I need to get the list of noise words (I, am, a).I have written a logic where I will split the sentence into words and process word by word. I will first take one word and I have a select statement which will throw SQL noise word error exception if it is noise word.

Logic is
1. Take a word from the sentence.
2. Write a select statement like "select * from job where contains (jobdescription,' extracted word')"
3. If the word is noise word then SQL will throw a noise word exception.
4. I try to capture this error and based on that I have some logic.
5. If noise error thrown (I am using @.@.error)
do this;
do this;
else
do this;
do this;
6. Now my problem is, when the SQL throws noise exception, the execution of the SP stops immediately and the rest of the logic is not executed.
7. But some how I need to capture the exception and continue with the program flow.

I have different logic where I can achieve my requirements. (Instead of capturing SQL exception, maintain the noise words in a table and check with the table). but my question is there any way where I can capture the SQL exception and continue the program flow?

Please reply to my mail id.

TIA,
Varada.Can we do this 1 problem at a time?

Are you looking for a word in a string?

Look up CHARINDEX

Capturing SQL from Upsizing Wizard

Is there a way in which I could capture the SQL (create table, insert...)
used by the Upsizing Wizard when moving from Access to SQL Server? Ideally
I'd like to be able to provide this to my users in the event that once we
completely phase out Access, they have something to "guide" them in the
creation/alteration of tables. Thanks in advance.
Hi
Run SQL Server Profiler on the target server.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"SABmore" wrote:

> Is there a way in which I could capture the SQL (create table, insert...)
> used by the Upsizing Wizard when moving from Access to SQL Server? Ideally
> I'd like to be able to provide this to my users in the event that once we
> completely phase out Access, they have something to "guide" them in the
> creation/alteration of tables. Thanks in advance.

Capturing SQL from Upsizing Wizard

Is there a way in which I could capture the SQL (create table, insert...)
used by the Upsizing Wizard when moving from Access to SQL Server? Ideally
I'd like to be able to provide this to my users in the event that once we
completely phase out Access, they have something to "guide" them in the
creation/alteration of tables. Thanks in advance.Hi
Run SQL Server Profiler on the target server.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"SABmore" wrote:
> Is there a way in which I could capture the SQL (create table, insert...)
> used by the Upsizing Wizard when moving from Access to SQL Server? Ideally
> I'd like to be able to provide this to my users in the event that once we
> completely phase out Access, they have something to "guide" them in the
> creation/alteration of tables. Thanks in advance.

Capturing SQL from Upsizing Wizard

Is there a way in which I could capture the SQL (create table, insert...)
used by the Upsizing Wizard when moving from Access to SQL Server? Ideally
I'd like to be able to provide this to my users in the event that once we
completely phase out Access, they have something to "guide" them in the
creation/alteration of tables. Thanks in advance.Hi
Run SQL Server Profiler on the target server.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"SABmore" wrote:

> Is there a way in which I could capture the SQL (create table, insert...)
> used by the Upsizing Wizard when moving from Access to SQL Server? Ideall
y
> I'd like to be able to provide this to my users in the event that once we
> completely phase out Access, they have something to "guide" them in the
> creation/alteration of tables. Thanks in advance.