I want to know what is the %CPU used by a process in SQL Server. In other
words, I got the CPUTime from the sysprocesses table and the number is say
10,000.
How can I relate this CPU time with NT processor percentage? A user called
me before running some stored procedure and wanted to know what is the
percentage of Total NT CPU this stored procedure is using?
Any idea?
Thanks in advanceHi David
Sysprocesses/CPU is a cumulative CPU usage and therefore can not be taken
against the current perfmon value. The amount of CPU any given stored
procedure takes will probably be slightly different each time it runs,
depending on what else is running and other factors such as how up-to-date
are the statistics or if it encountered blocking etc...
John
"David" wrote:
> I want to know what is the %CPU used by a process in SQL Server. In other
> words, I got the CPUTime from the sysprocesses table and the number is say
> 10,000.
> How can I relate this CPU time with NT processor percentage? A user called
> me before running some stored procedure and wanted to know what is the
> percentage of Total NT CPU this stored procedure is using?
> Any idea?
> Thanks in advance
Showing posts with label words. Show all posts
Showing posts with label words. Show all posts
Thursday, March 8, 2012
Sunday, February 19, 2012
counting when expressions is met
Am having trouble getting an expression to work that performs a count on a
different datset within a table. Firstly is this possible. In other words
table is based on dataset a but i want to have a colum that counts a field in
dataset b based on criteria. (ie field = 174). ThanksJust try this:
=Sum( iif(Fields!SomeFieldNameFromDatasetB.Value = 174, 1, 0), "b")
Note: If your condition is more complex and based on the current value of a
field in dataset A, then you have to work with subreports and pass the field
value from dataset A as parameter to the subreport.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:6AA0A8A4-17EC-40E0-92FC-1E91D3932219@.microsoft.com...
> Am having trouble getting an expression to work that performs a count on a
> different datset within a table. Firstly is this possible. In other words
> table is based on dataset a but i want to have a colum that counts a field
in
> dataset b based on criteria. (ie field = 174). Thanks|||thanks robert ill try it in a sec, what does the lower case 'b" do.
"Robert Bruckner [MSFT]" wrote:
> Just try this:
> =Sum( iif(Fields!SomeFieldNameFromDatasetB.Value = 174, 1, 0), "b")
> Note: If your condition is more complex and based on the current value of a
> field in dataset A, then you have to work with subreports and pass the field
> value from dataset A as parameter to the subreport.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:6AA0A8A4-17EC-40E0-92FC-1E91D3932219@.microsoft.com...
> > Am having trouble getting an expression to work that performs a count on a
> > different datset within a table. Firstly is this possible. In other words
> > table is based on dataset a but i want to have a colum that counts a field
> in
> > dataset b based on criteria. (ie field = 174). Thanks
>
>|||The lower-case b is the name of the second data set (which represents the
scope for the aggregate function). Every aggregate function has an optional
scope parameter.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:4D0E11A9-ED32-4703-8131-CFC61B671BC0@.microsoft.com...
> thanks robert ill try it in a sec, what does the lower case 'b" do.
> "Robert Bruckner [MSFT]" wrote:
> > Just try this:
> > =Sum( iif(Fields!SomeFieldNameFromDatasetB.Value = 174, 1, 0), "b")
> >
> > Note: If your condition is more complex and based on the current value
of a
> > field in dataset A, then you have to work with subreports and pass the
field
> > value from dataset A as parameter to the subreport.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > news:6AA0A8A4-17EC-40E0-92FC-1E91D3932219@.microsoft.com...
> > > Am having trouble getting an expression to work that performs a count
on a
> > > different datset within a table. Firstly is this possible. In other
words
> > > table is based on dataset a but i want to have a colum that counts a
field
> > in
> > > dataset b based on criteria. (ie field = 174). Thanks
> >
> >
> >
different datset within a table. Firstly is this possible. In other words
table is based on dataset a but i want to have a colum that counts a field in
dataset b based on criteria. (ie field = 174). ThanksJust try this:
=Sum( iif(Fields!SomeFieldNameFromDatasetB.Value = 174, 1, 0), "b")
Note: If your condition is more complex and based on the current value of a
field in dataset A, then you have to work with subreports and pass the field
value from dataset A as parameter to the subreport.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:6AA0A8A4-17EC-40E0-92FC-1E91D3932219@.microsoft.com...
> Am having trouble getting an expression to work that performs a count on a
> different datset within a table. Firstly is this possible. In other words
> table is based on dataset a but i want to have a colum that counts a field
in
> dataset b based on criteria. (ie field = 174). Thanks|||thanks robert ill try it in a sec, what does the lower case 'b" do.
"Robert Bruckner [MSFT]" wrote:
> Just try this:
> =Sum( iif(Fields!SomeFieldNameFromDatasetB.Value = 174, 1, 0), "b")
> Note: If your condition is more complex and based on the current value of a
> field in dataset A, then you have to work with subreports and pass the field
> value from dataset A as parameter to the subreport.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:6AA0A8A4-17EC-40E0-92FC-1E91D3932219@.microsoft.com...
> > Am having trouble getting an expression to work that performs a count on a
> > different datset within a table. Firstly is this possible. In other words
> > table is based on dataset a but i want to have a colum that counts a field
> in
> > dataset b based on criteria. (ie field = 174). Thanks
>
>|||The lower-case b is the name of the second data set (which represents the
scope for the aggregate function). Every aggregate function has an optional
scope parameter.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:4D0E11A9-ED32-4703-8131-CFC61B671BC0@.microsoft.com...
> thanks robert ill try it in a sec, what does the lower case 'b" do.
> "Robert Bruckner [MSFT]" wrote:
> > Just try this:
> > =Sum( iif(Fields!SomeFieldNameFromDatasetB.Value = 174, 1, 0), "b")
> >
> > Note: If your condition is more complex and based on the current value
of a
> > field in dataset A, then you have to work with subreports and pass the
field
> > value from dataset A as parameter to the subreport.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > news:6AA0A8A4-17EC-40E0-92FC-1E91D3932219@.microsoft.com...
> > > Am having trouble getting an expression to work that performs a count
on a
> > > different datset within a table. Firstly is this possible. In other
words
> > > table is based on dataset a but i want to have a colum that counts a
field
> > in
> > > dataset b based on criteria. (ie field = 174). Thanks
> >
> >
> >
Friday, February 17, 2012
Counting No Of Words In a Column
Hi,
for some reason, i had to write a function to count the number of words in a particular column in a table. (pl find the attachment). i would like to know whether there is any other mechanism with which we can count the number of words in a particular column.
for example, if the column data is,'This Is A Test', the function, will return 4.
pl suggest any other efficient strategies to accomplish this
thanksIs this too simple?
DECLARE @.Text AS VarChar(100)
SET @.Text = 'This is a sentence'
PRINT 'Number of words: ' + CAST(LEN(@.Text) - LEN(REPLACE(@.Text, ' ', '')) +1 AS VarChar(3))|||BTW - if it isn't then it is vastly more efficient.|||Is this too simple?
DECLARE @.Text AS VarChar(100)
SET @.Text = 'This is a sentence'
PRINT 'Number of words: ' + CAST(LEN(@.Text) - LEN(REPLACE(@.Text, ' ', '')) +1 AS VarChar(3))
one more qn..
wat if the data contains blank space
e.g. : 'This Is A Sentence '|||Bol
Rtrim(ltrim())|||Bol
Rtrim(ltrim())
Thank U all for the comments...
:)|||A bigger issue would be if the text contains double spaces:
"This is a single line of text. This text contains two sentences separated by two space characters."|||A bigger issue would be if the text contains double spaces:
"This is a single line of text. This text contains two sentences separated by two space characters."
LEN(REPLACE(@.Text, ' ', ' ')) - LEN(REPLACE(REPLACE(@.Text, ' ', ' '), ' ', '')) +1 :)|||You're gonna ask about triple spaces now ain't cha?|||Yup. I am.
To make this robust, you need a loop to eliminate double spaces until none remain. And that means this should be a multi-step function rather than a simple formula.|||Does the OP live in Iceland?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56195&whichpage=1|||... you need a loop ...muthaf*$#%$n loops in a muthaf*$#%$n function?
next you're going to suggest using a cursor, aren't you
:)
for some reason, i had to write a function to count the number of words in a particular column in a table. (pl find the attachment). i would like to know whether there is any other mechanism with which we can count the number of words in a particular column.
for example, if the column data is,'This Is A Test', the function, will return 4.
pl suggest any other efficient strategies to accomplish this
thanksIs this too simple?
DECLARE @.Text AS VarChar(100)
SET @.Text = 'This is a sentence'
PRINT 'Number of words: ' + CAST(LEN(@.Text) - LEN(REPLACE(@.Text, ' ', '')) +1 AS VarChar(3))|||BTW - if it isn't then it is vastly more efficient.|||Is this too simple?
DECLARE @.Text AS VarChar(100)
SET @.Text = 'This is a sentence'
PRINT 'Number of words: ' + CAST(LEN(@.Text) - LEN(REPLACE(@.Text, ' ', '')) +1 AS VarChar(3))
one more qn..
wat if the data contains blank space
e.g. : 'This Is A Sentence '|||Bol
Rtrim(ltrim())|||Bol
Rtrim(ltrim())
Thank U all for the comments...
:)|||A bigger issue would be if the text contains double spaces:
"This is a single line of text. This text contains two sentences separated by two space characters."|||A bigger issue would be if the text contains double spaces:
"This is a single line of text. This text contains two sentences separated by two space characters."
LEN(REPLACE(@.Text, ' ', ' ')) - LEN(REPLACE(REPLACE(@.Text, ' ', ' '), ' ', '')) +1 :)|||You're gonna ask about triple spaces now ain't cha?|||Yup. I am.
To make this robust, you need a loop to eliminate double spaces until none remain. And that means this should be a multi-step function rather than a simple formula.|||Does the OP live in Iceland?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56195&whichpage=1|||... you need a loop ...muthaf*$#%$n loops in a muthaf*$#%$n function?
next you're going to suggest using a cursor, aren't you
:)
Subscribe to:
Posts (Atom)