Showing posts with label number. Show all posts
Showing posts with label number. Show all posts

Thursday, March 29, 2012

field limitation

is there limitation in number of characters for a field?
Hi,
Yes, there are restriction.
Character Strings information:-
char
Fixed-length non-Unicode character data with a maximum length of 8,000
characters.
varchar
Variable-length non-Unicode data with a maximum of 8,000 characters.
text
Variable-length non-Unicode data with a maximum length of 2^31 - 1
(2,147,483,647) characters.
See topic "data types" in SQL Server books online for more details.
Thanks
Hari
MCDBA
"TOM P." <TOMP@.discussions.microsoft.com> wrote in message
news:EA967BEE-D85D-42B3-B0EB-CD6498B37189@.microsoft.com...
> is there limitation in number of characters for a field?

field limitation

is there limitation in number of characters for a field?Hi,
Yes, there are restriction.
Character Strings information:-
char
Fixed-length non-Unicode character data with a maximum length of 8,000
characters.
varchar
Variable-length non-Unicode data with a maximum of 8,000 characters.
text
Variable-length non-Unicode data with a maximum length of 2^31 - 1
(2,147,483,647) characters.
See topic "data types" in SQL Server books online for more details.
Thanks
Hari
MCDBA
"TOM P." <TOMP@.discussions.microsoft.com> wrote in message
news:EA967BEE-D85D-42B3-B0EB-CD6498B37189@.microsoft.com...
> is there limitation in number of characters for a field?

field limitation

is there limitation in number of characters for a field?Hi,
Yes, there are restriction.
Character Strings information:-
char
Fixed-length non-Unicode character data with a maximum length of 8,000
characters.
varchar
Variable-length non-Unicode data with a maximum of 8,000 characters.
text
Variable-length non-Unicode data with a maximum length of 2^31 - 1
(2,147,483,647) characters.
See topic "data types" in SQL Server books online for more details.
Thanks
Hari
MCDBA
"TOM P." <TOMP@.discussions.microsoft.com> wrote in message
news:EA967BEE-D85D-42B3-B0EB-CD6498B37189@.microsoft.com...
> is there limitation in number of characters for a field?|||>--Original Message--
>is there limitation in number of characters for a field?
>.
> hope this is what u r looking for :
The default maximum precision of numeric and decimal data
types is 38. In previous versions of SQL Server, the
default maximum was 28.
When two char, varchar, binary, or varbinary expressions
are concatenated, the length of the resulting expression
is the sum of the lengths of the two source expressions or
8,000 characters, whichever is less.
When two nchar or nvarchar expressions are concatenated,
the length of the resulting expression is the sum of the
lengths of the two source expressions, or 4,000
characters, whichever is less.
this is extracted from the SQL Books Online
rdgs

Monday, March 26, 2012

fetching data in a datatable

hello, i'm using asp.net 2 with VB, i have a table in my db named 'exams' and i have 6 columns in this table one for question number and one for the question and 3 columns for 3 answers and a last column for the right answer, now in my page i want to show 7 questions and each question has 3 answers that i can choose between them i want the question appear in datatable and the answers in radiolist i have a little code for that but it shows an error it says "no row at position 1" so hope u guys can help :

Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnetdb.mdf;Integrated Security=True;User Instance=True")
Dim a As New ArrayList(8)
Dim i As New Integer
i = 0
Dim d As New DataSet()
Dim cmd As New SqlDataAdapter("select top(7) question from exams", con)
cmd.Fill(d, "exams")
a.Add(d.Tables.Item(0, 1))
i = i + 1
Dim ta As New DataTable
ta.Rows(i).Item(0).text = d.Tables(0).Rows(0)(i)

and by the way this code is for the questions i still dont have the code for the answers that will appear in a radiolist hope u can help .thanksnobody can help?!!!!|||Are you sure the sql query did return result?
This error always occurs if you specify an index that is out of range.sql

Feedback wanted: Simulating @@Identitt behavior

Traditionally, implementing an alternative for the MS SQL Server
IDENTITY in Oracle is pretty straight forward:
e.g:
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
END;
/
So far so good.
However, in my case I am dealing with a large application which is
running 'mixed', eg, originally designed for MS SQL Sever, and now
being adapted to run under Oracle as well. As the @.@.Identity is wildly
used, I thought of an alternative for returning the last identiry
value. As the queries themselves are already parsed, replacing all
occurrences of @.@.Identity with something else is a breeze.
So, my idea is to implement a global identity value with a package.
Can anybody tell me if the following is a good or a bad plan, and if
there are any caveats?
Thanks
Code:
CREATE OR REPLACE PACKAGE SomePackageName
IS
FUNCTION GetIdentity RETURN NUMBER;
PROCEDURE SetIdentity(Identity IN NUMBER);
END SomePackageName;
/
CREATE OR REPLACE PACKAGE BODY SomePackageName
IS
Identity NUMBER(10) := NULL;
FUNCTION GetIdentity
RETURN NUMBER
IS
BEGIN
RETURN Identity;
END;
PROCEDURE SetIdentity(Identity IN NUMBER)
IS
BEGIN
SomePackageName.Identity := Identity;
END;
END SomePackageName;
/
CREATE TABLE MyTable(
ID NUMBER(10) NOT NULL,
Description VARCHAR2(128)
)
/
CREATE SEQUENCE SeqMyTable
/
CREATE OR REPLACE TRIGGER TiMyTable BEFORE INSERT ON MyTable
FOR EACH ROW
BEGIN
SELECT NVL(:new.ID, SeqMyTable.NEXTVAL) INTO :new.ID FROM DUAL;
SomePackageName.SetIdentity(:new.ID);
END;
/
Application example:
SET SERVEROUTPUT ON;
DECLARE
NewID NUMBER(10);
BEGIN
INSERT INTO MyTable(Description) VALUES('Hello world');
NewID := SomePackageName.GetIdentity;
dbms_output.put_line('New ID = ' || TO_CHAR(NewID));
END;
/
Hmmm, actually, I'd better post this in the Oracle groups. Sorry for
spamming Oracle stuff here.

Friday, March 23, 2012

feature requests to MS? How? Where?

Hi,
Anyone know how to request features for SQL server?
eg "reverse index" - like a phone number, if it was
reversed in the index it would be highly selective and low
density which would make it a lot faster. In Sydney
Australia most numbers have a 9 in the begining...
eg #2. "Ent. Mgr, diagrams across 2 or more databases".
Currently you can only diagram across one db at a time. I
have multiple db related.
eg #3. "programing sql trees". Support for programing sql
trees / parent child relationships.
And all sorts of other stuff developers and dba's need.
Cheers,
JohnSend email to :- sqlwish@.microsoft.com
--
HTH
Ryan Waight, MCDBA, MCSE
"John" <john.reed@.ht.com.au> wrote in message
news:0b4a01c3a455$57b94180$a301280a@.phx.gbl...
> Hi,
> Anyone know how to request features for SQL server?
> eg "reverse index" - like a phone number, if it was
> reversed in the index it would be highly selective and low
> density which would make it a lot faster. In Sydney
> Australia most numbers have a 9 in the begining...
> eg #2. "Ent. Mgr, diagrams across 2 or more databases".
> Currently you can only diagram across one db at a time. I
> have multiple db related.
> eg #3. "programing sql trees". Support for programing sql
> trees / parent child relationships.
> And all sorts of other stuff developers and dba's need.
> Cheers,
> John|||"John" <john.reed@.ht.com.au> wrote in message
news:0b4a01c3a455$57b94180$a301280a@.phx.gbl...
> eg "reverse index" - like a phone number, if it was
> reversed in the index it would be highly selective and low
> density which would make it a lot faster. In Sydney
> Australia most numbers have a 9 in the begining...
Store them backwards...
> eg #3. "programing sql trees". Support for programing sql
> trees / parent child relationships.
How is this not already supported?

Monday, March 12, 2012

Fat bar in Bar Chart

I have a percent stacked bar chart. For a number of entries it shows nice,
however, if there is only one entry, the one bar fills the whole chart,
obscuring any major/minor grid lines as well.
Is there a way to specify something so that the width of the one single bar
is more respectable?
Thanks.Yes there is a way to control the width of columns and bars. The property is
called "PointWidth". However, the property is only supported on the report
server (and preview).
What you need to do is:
* open your RDL file in a text / xml-editor
* search for the chart (<chart name="...">)
* add a PointWidth value between 0 and 100 (by default it is 55)
Example:
<Chart Name="Sales">
<PointWidth>10</PointWidth>
...
</Chart>
See also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsrdl/htm/rsp_ref_rdl_elements_fp_87lg.asp
Note: PointWidth is a constant value, so if you have an unknown number of
categories at runtime you might want to use two identical charts (one with
regular PointWidth, the other with a small PointWidth) and based on a
condition (number of categories) always hide one chart.
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Chris Botha" <chris_s_botha@.AT_h.o.t.m.a.i.l.com> wrote in message
news:%23mT$8gsZEHA.3476@.tk2msftngp13.phx.gbl...
> I have a percent stacked bar chart. For a number of entries it shows nice,
> however, if there is only one entry, the one bar fills the whole chart,
> obscuring any major/minor grid lines as well.
> Is there a way to specify something so that the width of the one single
bar
> is more respectable?
> Thanks.
>|||Hi Robert, thanks for the answer.
I found that the PointWidth has an affect if there are two or more bars, but
it has no affect for one bar, as one bar still fills the whole chart. I like
the charting features, especially after SP1, just this looks sort of tacky.
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:eG99i3sZEHA.4092@.TK2MSFTNGP11.phx.gbl...
> Yes there is a way to control the width of columns and bars. The property
is
> called "PointWidth". However, the property is only supported on the report
> server (and preview).
> What you need to do is:
> * open your RDL file in a text / xml-editor
> * search for the chart (<chart name="...">)
> * add a PointWidth value between 0 and 100 (by default it is 55)
> Example:
> <Chart Name="Sales">
> <PointWidth>10</PointWidth>
> ...
> </Chart>
> See also:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsrdl/htm/rsp_ref_rdl_elements_fp_87lg.asp
> Note: PointWidth is a constant value, so if you have an unknown number of
> categories at runtime you might want to use two identical charts (one with
> regular PointWidth, the other with a small PointWidth) and based on a
> condition (number of categories) always hide one chart.
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Chris Botha" <chris_s_botha@.AT_h.o.t.m.a.i.l.com> wrote in message
> news:%23mT$8gsZEHA.3476@.tk2msftngp13.phx.gbl...
> > I have a percent stacked bar chart. For a number of entries it shows
nice,
> > however, if there is only one entry, the one bar fills the whole chart,
> > obscuring any major/minor grid lines as well.
> > Is there a way to specify something so that the width of the one single
> bar
> > is more respectable?
> >
> > Thanks.
> >
> >
>|||You should turn on "side margins" for the x-axis.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Chris Botha" <chris_s_botha@.AT_h.o.t.m.a.i.l.com> wrote in message
news:eLqMvZuZEHA.1000@.TK2MSFTNGP12.phx.gbl...
> Hi Robert, thanks for the answer.
> I found that the PointWidth has an affect if there are two or more bars,
but
> it has no affect for one bar, as one bar still fills the whole chart. I
like
> the charting features, especially after SP1, just this looks sort of
tacky.
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:eG99i3sZEHA.4092@.TK2MSFTNGP11.phx.gbl...
> > Yes there is a way to control the width of columns and bars. The
property
> is
> > called "PointWidth". However, the property is only supported on the
report
> > server (and preview).
> >
> > What you need to do is:
> > * open your RDL file in a text / xml-editor
> > * search for the chart (<chart name="...">)
> > * add a PointWidth value between 0 and 100 (by default it is 55)
> >
> > Example:
> > <Chart Name="Sales">
> > <PointWidth>10</PointWidth>
> > ...
> > </Chart>
> >
> > See also:
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsrdl/htm/rsp_ref_rdl_elements_fp_87lg.asp
> >
> > Note: PointWidth is a constant value, so if you have an unknown number
of
> > categories at runtime you might want to use two identical charts (one
with
> > regular PointWidth, the other with a small PointWidth) and based on a
> > condition (number of categories) always hide one chart.
> >
> > --
> > Robert M. Bruckner
> > Microsoft SQL Server Reporting Services
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> > "Chris Botha" <chris_s_botha@.AT_h.o.t.m.a.i.l.com> wrote in message
> > news:%23mT$8gsZEHA.3476@.tk2msftngp13.phx.gbl...
> > > I have a percent stacked bar chart. For a number of entries it shows
> nice,
> > > however, if there is only one entry, the one bar fills the whole
chart,
> > > obscuring any major/minor grid lines as well.
> > > Is there a way to specify something so that the width of the one
single
> > bar
> > > is more respectable?
> > >
> > > Thanks.
> > >
> > >
> >
> >
>|||Right, thanks, that does it.
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:#nIuy2uZEHA.3012@.tk2msftngp13.phx.gbl...
> You should turn on "side margins" for the x-axis.
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> "Chris Botha" <chris_s_botha@.AT_h.o.t.m.a.i.l.com> wrote in message
> news:eLqMvZuZEHA.1000@.TK2MSFTNGP12.phx.gbl...
> > Hi Robert, thanks for the answer.
> > I found that the PointWidth has an affect if there are two or more bars,
> but
> > it has no affect for one bar, as one bar still fills the whole chart. I
> like
> > the charting features, especially after SP1, just this looks sort of
> tacky.
> >
> > "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> > news:eG99i3sZEHA.4092@.TK2MSFTNGP11.phx.gbl...
> > > Yes there is a way to control the width of columns and bars. The
> property
> > is
> > > called "PointWidth". However, the property is only supported on the
> report
> > > server (and preview).
> > >
> > > What you need to do is:
> > > * open your RDL file in a text / xml-editor
> > > * search for the chart (<chart name="...">)
> > > * add a PointWidth value between 0 and 100 (by default it is 55)
> > >
> > > Example:
> > > <Chart Name="Sales">
> > > <PointWidth>10</PointWidth>
> > > ...
> > > </Chart>
> > >
> > > See also:
> > >
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsrdl/htm/rsp_ref_rdl_elements_fp_87lg.asp
> > >
> > > Note: PointWidth is a constant value, so if you have an unknown number
> of
> > > categories at runtime you might want to use two identical charts (one
> with
> > > regular PointWidth, the other with a small PointWidth) and based on a
> > > condition (number of categories) always hide one chart.
> > >
> > > --
> > > Robert M. Bruckner
> > > Microsoft SQL Server Reporting Services
> > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > >
> > > "Chris Botha" <chris_s_botha@.AT_h.o.t.m.a.i.l.com> wrote in message
> > > news:%23mT$8gsZEHA.3476@.tk2msftngp13.phx.gbl...
> > > > I have a percent stacked bar chart. For a number of entries it shows
> > nice,
> > > > however, if there is only one entry, the one bar fills the whole
> chart,
> > > > obscuring any major/minor grid lines as well.
> > > > Is there a way to specify something so that the width of the one
> single
> > > bar
> > > > is more respectable?
> > > >
> > > > Thanks.
> > > >
> > > >
> > >
> > >
> >
> >
>

Friday, March 9, 2012

Faster select count(*)

About 50% of the search time is spent just counting the number of rows in
the resultset.
We page the resultset and show only one page at a time. Is there any way we
can count
the number of rows in the resultset faster?
CasperMore information, please -- counting what result set? Are you doing this on
the client side? Can you show the code you're currently using?
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
"Casper Hornstrup" <msdn@.csite.com> wrote in message
news:OcflLTjLFHA.3000@.TK2MSFTNGP10.phx.gbl...
> About 50% of the search time is spent just counting the number of rows in
> the resultset.
> We page the resultset and show only one page at a time. Is there any way
we
> can count
> the number of rows in the resultset faster?
> Casper
>|||select rowcnt from sysindexes
where id = object_id(N'[table]') and indid = 1
(indid = 1) is PK constraints I believe, so may not work for heaps; other
indexes don't appear to track rowcnt. Also the rwcnt field I don't think is
kept 100% current, so probably not accurate enough for your needs. But it's
there anyways ;)
- KH
"Casper Hornstrup" wrote:

> About 50% of the search time is spent just counting the number of rows in
> the resultset.
> We page the resultset and show only one page at a time. Is there any way w
e
> can count
> the number of rows in the resultset faster?
> Casper
>
>|||http://www.aspfaq.com/2120
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Casper Hornstrup" <msdn@.csite.com> wrote in message
news:OcflLTjLFHA.3000@.TK2MSFTNGP10.phx.gbl...
> About 50% of the search time is spent just counting the number of rows in
> the resultset.
> We page the resultset and show only one page at a time. Is there any way
we
> can count
> the number of rows in the resultset faster?
> Casper
>|||> select rowcnt from sysindexes
> where id = object_id(N'[table]') and indid = 1
That will give you a rough count of what's in the entire table. However,
the OP said they wanted the count of the resultset... which is likely a
combination of a join between multiple tables and a filtered where clause.|||Yea, the original question is pretty ambiguious.
In the scenario you suggest using @.@.ROWCOUNT after the select might work for
this application.
It all depends eh? ;)
- KH
"Aaron [SQL Server MVP]" wrote:

> That will give you a rough count of what's in the entire table. However,
> the OP said they wanted the count of the resultset... which is likely a
> combination of a join between multiple tables and a filtered where clause.
>
>|||"examnotes" <KH@.discussions.microsoft.com> wrote in message news:<5EC86F57-C7F7-4AC0
-A197-B1C677605F8A@.microsoft.com>...
> Yea, the original question is pretty ambiguious.
> In the scenario you suggest using @.@.ROWCOUNT after the select might work f
or
> this application.
> It all depends eh? ;)
> - KH
>
> "Aaron [SQL Server MVP]" wrote:
>
respond

Sunday, February 26, 2012

Farmat number into Date

I am reporting off an oracle database that has a field with a number that is
the date. ie 20041201 (yyyymmdd)
What would be the best way to convert this into a date with the format
dd/mm/yy.
I regularly use this field with a parameter to allow my usres to generate
their own reports.
Thanks in advanceLook at the DateTime structure and its constructors:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimememberstopic.asp
The following expression would convert the field into a valid DateTime
object:
=new DateTime(Left(CStr(Fields!Date.Value), 4), Mid(CStr(Fields!Date.Value),
5, 2), Right(CStr(Fields!Date.Value), 2))
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:9EA0FDAC-20C4-459A-AD30-AE5F439A38B2@.microsoft.com...
>I am reporting off an oracle database that has a field with a number that
>is
> the date. ie 20041201 (yyyymmdd)
> What would be the best way to convert this into a date with the format
> dd/mm/yy.
> I regularly use this field with a parameter to allow my usres to generate
> their own reports.
> Thanks in advance|||Thank you Robert,
At what point would you recommend i use this expression.
Is it possible to use at the dataset stage and if so how.
Regards
Todd
"Robert Bruckner [MSFT]" wrote:
> Look at the DateTime structure and its constructors:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimememberstopic.asp
> The following expression would convert the field into a valid DateTime
> object:
> =new DateTime(Left(CStr(Fields!Date.Value), 4), Mid(CStr(Fields!Date.Value),
> 5, 2), Right(CStr(Fields!Date.Value), 2))
>
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:9EA0FDAC-20C4-459A-AD30-AE5F439A38B2@.microsoft.com...
> >I am reporting off an oracle database that has a field with a number that
> >is
> > the date. ie 20041201 (yyyymmdd)
> >
> > What would be the best way to convert this into a date with the format
> > dd/mm/yy.
> > I regularly use this field with a parameter to allow my usres to generate
> > their own reports.
> >
> > Thanks in advance
>
>|||If you want to perform the conversion in the query instead of inside the
report (or by adding a calculated field on the dataset), you have to find
function calls in the query language that allow you to convert the field
into a DateTime object. The data provider / database server of the data
source will determine the language that has to be used (T-SQL, PL/SQL, etc.)
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:63B337CF-3563-4DA4-AC77-18429117803F@.microsoft.com...
> Thank you Robert,
> At what point would you recommend i use this expression.
> Is it possible to use at the dataset stage and if so how.
> Regards
> Todd
> "Robert Bruckner [MSFT]" wrote:
>> Look at the DateTime structure and its constructors:
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatetimememberstopic.asp
>> The following expression would convert the field into a valid DateTime
>> object:
>> =new DateTime(Left(CStr(Fields!Date.Value), 4),
>> Mid(CStr(Fields!Date.Value),
>> 5, 2), Right(CStr(Fields!Date.Value), 2))
>>
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Tango" <Tango@.discussions.microsoft.com> wrote in message
>> news:9EA0FDAC-20C4-459A-AD30-AE5F439A38B2@.microsoft.com...
>> >I am reporting off an oracle database that has a field with a number
>> >that
>> >is
>> > the date. ie 20041201 (yyyymmdd)
>> >
>> > What would be the best way to convert this into a date with the format
>> > dd/mm/yy.
>> > I regularly use this field with a parameter to allow my usres to
>> > generate
>> > their own reports.
>> >
>> > Thanks in advance
>>

False number of rows in sp_spaceused and sysindexes

Hi,
On a server with WS2003 / SQL2000 SP3, I must run everyday DBCC UpdateUsage
(0) With Count_Rows to correct the number of rows returned by sp_spaceused,
Enterprise Manager or in table sysindexes.
For example, I can have 318000 instead of 318256, 3456 instead of 3458
There was not this problem on a server with W2000 / SQL2000 SP1.
Anyone has an idea ?
Thanks,
SebastienI think you must have had statistics set to auto-update on the 2000 server,
and no longer have this set on the 2003 server.
I've never relied on sp_spaceused unless I also update stats before I run
it.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Sebastien" <nospam@.nospam.com> wrote in message
news:uXpFj4YoEHA.1272@.TK2MSFTNGP09.phx.gbl...
> Hi,
> On a server with WS2003 / SQL2000 SP3, I must run everyday DBCC
UpdateUsage
> (0) With Count_Rows to correct the number of rows returned by
sp_spaceused,
> Enterprise Manager or in table sysindexes.
> For example, I can have 318000 instead of 318256, 3456 instead of 3458
> There was not this problem on a server with W2000 / SQL2000 SP1.
> Anyone has an idea ?
> Thanks,
> Sebastien
>
>|||Hi Sebastien,
Thanks for your post.
As MVP Aaron said, there are some known issues in sp_spaceused, however,
you'd better take the following steps to see whether it make more effect.
First of all, take the latest updates of SQL Server. Some known issues are
fixed. For example,
FIX: Statistics Maintenance Creates Significant Bottleneck on SQL Servers
that Use 16 or More CPUs
http://support.microsoft.com/?id=293849
Secondly, run the command sp_spaceused like below
sp_spaceused @.updateusage = true
Note that when you include the "@.updateusage=true" parameter for
sp_spaceused, the sp will run DBCC UPDATEUSAGE, which will update the
allocation information in sysindexes to insure that it provides accurate
information. Running DBCC UPDATEUSAGE on the whole database is a
resource-intensive task and can have a significant impact on the
performance of a system. Note that sysindexes is also updated at
checkpoints (though not as thoroughly), so during peak load times you may
want to invesitgate omitting the @.updateusage parameter and running
"CHECKPOINT" before sp_spaceused instead.
Thank you for your patience and corperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!|||No, auto-update statistics option is ON on the 2 server for the database,
and auto-create is OFF.
sp_spaceused mytable,@.updateusage=true or update statistics don't correct
that.
Only DBCC UpdateUsage (0,mytable) With Count_Rows can correct !!!
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> a écrit dans le message de
news:u0KceEZoEHA.1644@.tk2msftngp13.phx.gbl...
> I think you must have had statistics set to auto-update on the 2000
server,
> and no longer have this set on the 2003 server.
> I've never relied on sp_spaceused unless I also update stats before I run
> it.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Sebastien" <nospam@.nospam.com> wrote in message
> news:uXpFj4YoEHA.1272@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> >
> > On a server with WS2003 / SQL2000 SP3, I must run everyday DBCC
> UpdateUsage
> > (0) With Count_Rows to correct the number of rows returned by
> sp_spaceused,
> > Enterprise Manager or in table sysindexes.
> >
> > For example, I can have 318000 instead of 318256, 3456 instead of 3458
> >
> > There was not this problem on a server with W2000 / SQL2000 SP1.
> >
> > Anyone has an idea ?
> >
> > Thanks,
> > Sebastien
> >
> >
> >
>|||Thanks for your reply.
The server run french version of SQL2000 with SP3a and only have 4 CPU Xeon
HT.
sp_spaceused @.updateusage = true or sp_spaceused mytable,@.updateusage =true don't solve the problem
only the dbcc command with Count_Rows can correct that !!!
Sebastien
""Mingqing Cheng [MSFT]"" <v-mingqc@.online.microsoft.com> a écrit dans le
message de news:NWreWReoEHA.3212@.cpmsftngxa06.phx.gbl...
> Hi Sebastien,
> Thanks for your post.
> As MVP Aaron said, there are some known issues in sp_spaceused, however,
> you'd better take the following steps to see whether it make more effect.
> First of all, take the latest updates of SQL Server. Some known issues are
> fixed. For example,
> FIX: Statistics Maintenance Creates Significant Bottleneck on SQL Servers
> that Use 16 or More CPUs
> http://support.microsoft.com/?id=293849
> Secondly, run the command sp_spaceused like below
> sp_spaceused @.updateusage = true
> Note that when you include the "@.updateusage=true" parameter for
> sp_spaceused, the sp will run DBCC UPDATEUSAGE, which will update the
> allocation information in sysindexes to insure that it provides accurate
> information. Running DBCC UPDATEUSAGE on the whole database is a
> resource-intensive task and can have a significant impact on the
> performance of a system. Note that sysindexes is also updated at
> checkpoints (though not as thoroughly), so during peak load times you may
> want to invesitgate omitting the @.updateusage parameter and running
> "CHECKPOINT" before sp_spaceused instead.
> Thank you for your patience and corperation. If you have any questions or
> concerns, don't hesitate to let me know. We are here to be of assistance!
>
> Sincerely yours,
> Mingqing Cheng
> Online Partner Support Specialist
> Partner Support Group
> Microsoft Global Technical Support Center
> ---
> Introduction to Yukon! - http://www.microsoft.com/sql/yukon
> This posting is provided "as is" with no warranties and confers no rights.
> Please reply to newsgroups only, many thanks!
>
>|||Hi Sebastien,
Thanks for your further explaination.
Executing sp_spaceused computes the amount of disk space used for data and
indexes, and the disk space used by a table in the current database. If no
table (objname) is given, sp_spaceused reports on the space used by the
entire current database.
After you drop an index, sp_spaceused reports inaccurate information. This
is a known limitation. However, sp_spaceused provides a quick, rough
estimate. If you notice incorrect values when you execute sp_spaceused, run
DBCC UPDATEUSAGE to correct the inaccuracies. Because this statement takes
some time to run on large tables or databases use it only when you suspect
incorrect values being returned or when other users are not active.
I am afraid that you will have to run that DBCC command if sp_spaceused
@.updateusage = true doesn't make sence:(
I am sorry for the inconvenience it may caught. Thank you for your patience
and corperation. If you have any questions or concerns, don't hesitate to
let me know.
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!

False number of rows in sp_spaceused and sysindexes

Hi,
On a server with WS2003 / SQL2000 SP3, I must run everyday DBCC UpdateUsage
(0) With Count_Rows to correct the number of rows returned by sp_spaceused,
Enterprise Manager or in table sysindexes.
For example, I can have 318000 instead of 318256, 3456 instead of 3458
There was not this problem on a server with W2000 / SQL2000 SP1.
Anyone has an idea ?
Thanks,
Sebastien
I think you must have had statistics set to auto-update on the 2000 server,
and no longer have this set on the 2003 server.
I've never relied on sp_spaceused unless I also update stats before I run
it.
http://www.aspfaq.com/
(Reverse address to reply.)
"Sebastien" <nospam@.nospam.com> wrote in message
news:uXpFj4YoEHA.1272@.TK2MSFTNGP09.phx.gbl...
> Hi,
> On a server with WS2003 / SQL2000 SP3, I must run everyday DBCC
UpdateUsage
> (0) With Count_Rows to correct the number of rows returned by
sp_spaceused,
> Enterprise Manager or in table sysindexes.
> For example, I can have 318000 instead of 318256, 3456 instead of 3458
> There was not this problem on a server with W2000 / SQL2000 SP1.
> Anyone has an idea ?
> Thanks,
> Sebastien
>
>
|||Hi Sebastien,
Thanks for your post.
As MVP Aaron said, there are some known issues in sp_spaceused, however,
you'd better take the following steps to see whether it make more effect.
First of all, take the latest updates of SQL Server. Some known issues are
fixed. For example,
FIX: Statistics Maintenance Creates Significant Bottleneck on SQL Servers
that Use 16 or More CPUs
http://support.microsoft.com/?id=293849
Secondly, run the command sp_spaceused like below
sp_spaceused @.updateusage = true
Note that when you include the "@.updateusage=true" parameter for
sp_spaceused, the sp will run DBCC UPDATEUSAGE, which will update the
allocation information in sysindexes to insure that it provides accurate
information. Running DBCC UPDATEUSAGE on the whole database is a
resource-intensive task and can have a significant impact on the
performance of a system. Note that sysindexes is also updated at
checkpoints (though not as thoroughly), so during peak load times you may
want to invesitgate omitting the @.updateusage parameter and running
"CHECKPOINT" before sp_spaceused instead.
Thank you for your patience and corperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!
|||No, auto-update statistics option is ON on the 2 server for the database,
and auto-create is OFF.
sp_spaceused mytable,@.updateusage=true or update statistics don't correct
that.
Only DBCC UpdateUsage (0,mytable) With Count_Rows can correct !!!
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> a crit dans le message de
news:u0KceEZoEHA.1644@.tk2msftngp13.phx.gbl...
> I think you must have had statistics set to auto-update on the 2000
server,
> and no longer have this set on the 2003 server.
> I've never relied on sp_spaceused unless I also update stats before I run
> it.
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "Sebastien" <nospam@.nospam.com> wrote in message
> news:uXpFj4YoEHA.1272@.TK2MSFTNGP09.phx.gbl...
> UpdateUsage
> sp_spaceused,
>
|||Thanks for your reply.
The server run french version of SQL2000 with SP3a and only have 4 CPU Xeon
HT.
sp_spaceused @.updateusage = true or sp_spaceused mytable,@.updateusage =
true don't solve the problem
only the dbcc command with Count_Rows can correct that !!!
Sebastien
""Mingqing Cheng [MSFT]"" <v-mingqc@.online.microsoft.com> a crit dans le
message de news:NWreWReoEHA.3212@.cpmsftngxa06.phx.gbl...
> Hi Sebastien,
> Thanks for your post.
> As MVP Aaron said, there are some known issues in sp_spaceused, however,
> you'd better take the following steps to see whether it make more effect.
> First of all, take the latest updates of SQL Server. Some known issues are
> fixed. For example,
> FIX: Statistics Maintenance Creates Significant Bottleneck on SQL Servers
> that Use 16 or More CPUs
> http://support.microsoft.com/?id=293849
> Secondly, run the command sp_spaceused like below
> sp_spaceused @.updateusage = true
> Note that when you include the "@.updateusage=true" parameter for
> sp_spaceused, the sp will run DBCC UPDATEUSAGE, which will update the
> allocation information in sysindexes to insure that it provides accurate
> information. Running DBCC UPDATEUSAGE on the whole database is a
> resource-intensive task and can have a significant impact on the
> performance of a system. Note that sysindexes is also updated at
> checkpoints (though not as thoroughly), so during peak load times you may
> want to invesitgate omitting the @.updateusage parameter and running
> "CHECKPOINT" before sp_spaceused instead.
> Thank you for your patience and corperation. If you have any questions or
> concerns, don't hesitate to let me know. We are here to be of assistance!
>
> Sincerely yours,
> Mingqing Cheng
> Online Partner Support Specialist
> Partner Support Group
> Microsoft Global Technical Support Center
> Introduction to Yukon! - http://www.microsoft.com/sql/yukon
> This posting is provided "as is" with no warranties and confers no rights.
> Please reply to newsgroups only, many thanks!
>
>
|||Hi Sebastien,
Thanks for your further explaination.
Executing sp_spaceused computes the amount of disk space used for data and
indexes, and the disk space used by a table in the current database. If no
table (objname) is given, sp_spaceused reports on the space used by the
entire current database.
After you drop an index, sp_spaceused reports inaccurate information. This
is a known limitation. However, sp_spaceused provides a quick, rough
estimate. If you notice incorrect values when you execute sp_spaceused, run
DBCC UPDATEUSAGE to correct the inaccuracies. Because this statement takes
some time to run on large tables or databases use it only when you suspect
incorrect values being returned or when other users are not active.
I am afraid that you will have to run that DBCC command if sp_spaceused
@.updateusage = true doesn't make sence
I am sorry for the inconvenience it may caught. Thank you for your patience
and corperation. If you have any questions or concerns, don't hesitate to
let me know.
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!