Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Friday, March 30, 2012

rowmodctr

why rowmodctr in sysindexes table shows negative values instead of zero after
a index rebuild in sql 2000 ?
Thanks,
Ranga
Ranga,
The value of [rowmodctr] is increased just for index ID 0 or 1. For the
rest of indexes and statistics, it shows a relative value that has to be
added to the [rowmodctr] of the index 0 or 1 to get the true number of
changed rows for this index.
Statistics Used by the Query Optimizer in Microsoft SQL Server 2000
http://msdn2.microsoft.com/en-us/library/aa902688(SQL.80).aspx
AMB
"Ranga" wrote:

> why rowmodctr in sysindexes table shows negative values instead of zero after
> a index rebuild in sql 2000 ?
> Thanks,
> Ranga
|||Thanks...
I have two tables each has several non clustered indexes...for one of them
I see negative values in the rowmodctr, for the other table i see zero for
rowmodctr...though it is not causing any problems, just curious to know what
is behind this.
I did reindex first, and the value got set to zero, a nightly update
statistics job changed the zero value to a negative number ? Is this what
happenned ?
Ranga
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> Ranga,
> The value of [rowmodctr] is increased just for index ID 0 or 1. For the
> rest of indexes and statistics, it shows a relative value that has to be
> added to the [rowmodctr] of the index 0 or 1 to get the true number of
> changed rows for this index.
> Statistics Used by the Query Optimizer in Microsoft SQL Server 2000
> http://msdn2.microsoft.com/en-us/library/aa902688(SQL.80).aspx
>
> AMB
> "Ranga" wrote:

rowmodctr

why rowmodctr in sysindexes table shows negative values instead of zero afte
r
a index rebuild in sql 2000 ?
Thanks,
RangaRanga,
The value of [rowmodctr] is increased just for index ID 0 or 1. For the
rest of indexes and statistics, it shows a relative value that has to be
added to the [rowmodctr] of the index 0 or 1 to get the true number of
changed rows for this index.
Statistics Used by the Query Optimizer in Microsoft SQL Server 2000
http://msdn2.microsoft.com/en-us/library/aa902688(SQL.80).aspx
AMB
"Ranga" wrote:

> why rowmodctr in sysindexes table shows negative values instead of zero af
ter
> a index rebuild in sql 2000 ?
> Thanks,
> Ranga|||Thanks...
I have two tables each has several non clustered indexes...for one of them
I see negative values in the rowmodctr, for the other table i see zero for
rowmodctr...though it is not causing any problems, just curious to know wha
t
is behind this.
I did reindex first, and the value got set to zero, a nightly update
statistics job changed the zero value to a negative number ? Is this what
happenned ?
Ranga
"Alejandro Mesa" wrote:
[vbcol=seagreen]
> Ranga,
> The value of [rowmodctr] is increased just for index ID 0 or 1. For t
he
> rest of indexes and statistics, it shows a relative value that has to be
> added to the [rowmodctr] of the index 0 or 1 to get the true number of
> changed rows for this index.
> Statistics Used by the Query Optimizer in Microsoft SQL Server 2000
> http://msdn2.microsoft.com/en-us/library/aa902688(SQL.80).aspx
>
> AMB
> "Ranga" wrote:
>sql

rowmodctr

why rowmodctr in sysindexes table shows negative values instead of zero after
a index rebuild in sql 2000 ?
Thanks,
RangaRanga,
The value of [rowmodctr] is increased just for index ID 0 or 1. For the
rest of indexes and statistics, it shows a relative value that has to be
added to the [rowmodctr] of the index 0 or 1 to get the true number of
changed rows for this index.
Statistics Used by the Query Optimizer in Microsoft SQL Server 2000
http://msdn2.microsoft.com/en-us/library/aa902688(SQL.80).aspx
AMB
"Ranga" wrote:
> why rowmodctr in sysindexes table shows negative values instead of zero after
> a index rebuild in sql 2000 ?
> Thanks,
> Ranga|||Thanks...
I have two tables each has several non clustered indexes...for one of them
I see negative values in the rowmodctr, for the other table i see zero for
rowmodctr...though it is not causing any problems, just curious to know what
is behind this.
I did reindex first, and the value got set to zero, a nightly update
statistics job changed the zero value to a negative number ? Is this what
happenned ?
Ranga
"Alejandro Mesa" wrote:
> Ranga,
> The value of [rowmodctr] is increased just for index ID 0 or 1. For the
> rest of indexes and statistics, it shows a relative value that has to be
> added to the [rowmodctr] of the index 0 or 1 to get the true number of
> changed rows for this index.
> Statistics Used by the Query Optimizer in Microsoft SQL Server 2000
> http://msdn2.microsoft.com/en-us/library/aa902688(SQL.80).aspx
>
> AMB
> "Ranga" wrote:
> > why rowmodctr in sysindexes table shows negative values instead of zero after
> > a index rebuild in sql 2000 ?
> >
> > Thanks,
> > Ranga

Wednesday, March 7, 2012

Rounding error

This should return 73.34...

However, it returns a 0 instead.

select convert(decimal(18,2),(3370)/(4595)*100)

Can you pl advise.

Either add a .0 to the end of the numbers, or explicitly convert to float.

The reason is that SQL Server, when dividing integers, returns an integer.

select convert(decimal(18,2),(3370.0)/(4595.0)*100.0) returns 73.34

BobP

|||

To add to Bob's comment:

IF both the dividend and divisor are whole numbers (int), SQL assumes you want the results as an int.

IF either of the two contains a decimal, a float will be returned. For example:


SELECT (( 3370./4595 ) * 100.0 )

--
73.3405000

|||

The datatype on the field, acctno is Int.. I use the convert statement to convert to float. but it still returns the data in INt ie it return 3370 instead of 3370.0.. Though I AM using covnert to float, data is still returned as an INT.

Select round(count(convert(float,convert(decimal(38,5),acctno))),2) from tbl1
WHERE (tbl1.balance<>0).

Any ideas how I can return The value as 3370.0

|||

Count returns an int... so there is no decimal.

Use convert(float, count(...

BobP

|||

Whoa nellie! What's with the round(), count() convert(), convert(), etc.

There is reason to convert(), round(), etc., it you are only interested in the count of rows meeting the criteria.

SELECT cast( count( AcctNo ) AS decimal(10,2))

FROM tbl1

WHERE tbl1.Balance <> 0

'should' do the trick.

Saturday, February 25, 2012

Round Statement Incorrect Value

Hello,

I am having trouble getting the correct calculation with the statement below. The error is that QTR4 is being divided by Select SUM instead of all 4 quarters. I have tried closing the addition statements but get errors on all scenarios that Ive tried. How can I format this to correctly to add up all 4 quarters then do the division?

SELECT campus.campus,
ROUND(QTR1+QTR2+QTR3+QTR4/(SELECT SUM(QTR1+qtr2+qtr3+qtr4) FROM campus),2) "% CONT"
FROM campus;

CAMPUS % CONT
-- ----
Main 1300.16
East 700.08
West 300.04
North 350.04What do you mean by "closing the addition statement". Shouldn't you to put parenthesis over QTR1+QTR2+QTR3+QTR4 ?

SELECT campus.campus,
ROUND((QTR1+QTR2+QTR3+QTR4)/(SELECT SUM(QTR1+qtr2+qtr3+qtr4) FROM campus),2) "% CONT"
FROM campus;

Tuesday, February 21, 2012

Rotate Text to flow vertically instead of horizontally

Is it possible in the SSRS Report Designer to rotate a textbox to run vertically, or simply to rotate the text in a textbox ? I have only seen this done within axes lables of charts, but not text boxes.

Thanks in advance,
Kenny
Hi Kenny -

Here's a link to another thread that should provide the answer you're looking for.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=491642&SiteID=1

HTH...

Joe