--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...
In SQL Server 6.5, nullable CHAR columns were internally treated as
VARCHARs. In SQL Server 7.0 / 2000, nullable CHAR columns are actual CHARs.
Thus if you had, for instance, a column declared as CHAR (100) NULL in SQL
Server 6.5, and you usually only had 50 bytes of information in the column,
SQL Server 6.5 would only store the 50 bytes. In SQL Server 7.0 / 2000, the
column always holds a full 100 bytes.
-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
Quote:> I imported data from sqlserver 6.5 to sqlserver7.0. The content in
sqlserver
> 6.5 is 500MB. But the content in sqlserver 7.0 is increased to 1000MB.
Why?
treated as "varchar").Quote:> Perhaps because non-clustered indexes carries the clustered key in 7.0 (in
6.5 we always had a
> "pointer" which were 6 bytes).
> Also, null column are always as wide as the column (in 6.x they could be
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...Quote:> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
Quote:> > I imported data from sqlserver 6.5 to sqlserver7.0. The content in
sqlserver
> > 6.5 is 500MB. But the content in sqlserver 7.0 is increased to 1000MB.
Why?
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...
> > Perhaps because non-clustered indexes carries the clustered key in 7.0 (in
> 6.5 we always had a
> > "pointer" which were 6 bytes).
> > Also, null column are always as wide as the column (in 6.x they could be
> treated as "varchar").
> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at:
> http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sql...
> > > I imported data from sqlserver 6.5 to sqlserver7.0. The content in
> sqlserver
> > > 6.5 is 500MB. But the content in sqlserver 7.0 is increased to 1000MB.
> Why?
> In SQL Server 6.5, nullable CHAR columns were internally treated as
> VARCHARs. In SQL Server 7.0 / 2000, nullable CHAR columns are actual CHARs.
> Thus if you had, for instance, a column declared as CHAR (100) NULL in SQL
> Server 6.5, and you usually only had 50 bytes of information in the column,
> SQL Server 6.5 would only store the 50 bytes. In SQL Server 7.0 / 2000, the
> column always holds a full 100 bytes.
> -------------------------------------------
> BP Margolin
> Please reply only to the newsgroups.
> When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
> can be cut and pasted into Query Analyzer is appreciated.
> > I imported data from sqlserver 6.5 to sqlserver7.0. The content in
> sqlserver
> > 6.5 is 500MB. But the content in sqlserver 7.0 is increased to 1000MB.
> Why?
-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
> > In SQL Server 6.5, nullable CHAR columns were internally treated as
> > VARCHARs. In SQL Server 7.0 / 2000, nullable CHAR columns are actual
CHARs.
> > Thus if you had, for instance, a column declared as CHAR (100) NULL in
SQL
> > Server 6.5, and you usually only had 50 bytes of information in the
column,
> > SQL Server 6.5 would only store the 50 bytes. In SQL Server 7.0 / 2000,
the
> > column always holds a full 100 bytes.
> > -------------------------------------------
> > BP Margolin
> > Please reply only to the newsgroups.
> > When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.)
which
> > can be cut and pasted into Query Analyzer is appreciated.
> > > I imported data from sqlserver 6.5 to sqlserver7.0. The content in
> > sqlserver
> > > 6.5 is 500MB. But the content in sqlserver 7.0 is increased to 1000MB.
> > Why?
Besides, I watched the table size of this table in sql 6.5. According
to the size, I found it only takes up a bit more than 2 bytes for a
column of decimal (18.0) in average. I wonder if the data are stored
compressed.
Yes, this is true.Quote:> So far as the information I can found, it takes up 8 kB for every page
> in sqlserver 7.0 and 2kB in sqlserver 6.5. I wonder if this is true.
A column defined as DECIMAL (18, 0) in either SQL Server 6.5 or SQL ServerQuote:> Besides, I watched the table size of this table in sql 6.5. According
> to the size, I found it only takes up a bit more than 2 bytes for a
> column of decimal (18.0) in average. I wonder if the data are stored
> compressed.
What is peculiar, at least to me, is that the number of pages for the SQL
Server 7.0 table is 6859 while the number of pages for the SQL Server 6.5
table is only 5226. Assuming that the table does not have nullable CHAR
columns, I would have expected that, if the table has the same number of
rows, that the number of pages in SQL Server 7.0 would be approximately
one-quarter that of the number of pages in SQL Server 6.5 ... the 8K page
size vs. 2K page size thing :-)
Can you verify that the number of rows in the table is the same and that
there are no nullable CHAR columns in this table? Could you also post the
complete schema, including constraints and indexes of the table? Enterprise
Manager can help you produce the table schema. Just be sure to request all
the options so that all the constraints and indexes are also printed.
I seem to recall that SQL Server 7.0 and/or SQL Server 2000 would sometimes
produce extraordinary large number of pages for statistics. If you see an
index beginning with something like "_WA_" then that is a statistic
automatically generated by SQL Server, and perhaps that's where the problem
of the discrepancy in size lays.
What do you get when you do:
EXEC sp_help {tablename}
EXEC sp_spaceused {tablename}
for this table?
-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
Quote:> This is the result of excuting DBCC at one of the tables:
> sql 7:
> - Pages Scanned................................: 6859
> - Extents Scanned..............................: 859
> - Extent Switches..............................: 858
> - Avg. Pages per Extent........................: 8.0
> - Scan Density [Best Count:Actual Count].......: 99.88% [858:859]
> - Extent Scan Fragmentation ...................: 87.66%
> - Avg. Bytes Free per Page.....................: 1449.0
> - Avg. Page Density (full).....................: 82.10%
> sql 6.5
> - Pages Scanned................................: 5226
> - Extent Switches..............................: 655
> - Avg. Pages per Extent........................: 8.0
> - Scan Density [Best Count:Actual Count].......: 99.70% [653:656]
> - Avg. Bytes free per page.....................: 196.3
> - Avg. Page density (full).....................: 90.25%
> - Overflow Pages...............................: 5225
> - Avg. Bytes free per Overflow page............: 196.3
> - Avg. Overflow Page density...................: 90.3%
> - Disconnected Overflow Pages..................: 0
> So far as the information I can found, it takes up 8 kB for every page
> in sqlserver 7.0 and 2kB in sqlserver 6.5. I wonder if this is true.
> Besides, I watched the table size of this table in sql 6.5. According
> to the size, I found it only takes up a bit more than 2 bytes for a
> column of decimal (18.0) in average. I wonder if the data are stored
> compressed.
The result of executing the commands what you said is as follow:
in SQL Server 6.5
Name Owner Type
When_created
------------------------------ ------------------------------
----------------------------------------------------------------------
---------------------------
METER_FREEZE_DATA_2001_10 dbo user
table 10 1
2001 6:00AM
Data_located_on_segment
------------------------------
default
Column_name Type Length
Prec Scale Nullable TrimTrailingBlanks
FixedLenNullInSource
------------------------------ ------------------------------ ------
----- ----- -----------------------------------
-----------------------------------
-----------------------------------
ID smallint 2 5
0 no (n/a)
(n/a)
BIAO_NO tinyint 1 3
0 no (n/a)
(n/a)
FREEZE_DAY tinyint 1 3
0 no (n/a)
(n/a)
FREEZE_HOUR tinyint 1 3
0 no (n/a)
(n/a)
FREEZE_MINUTE tinyint 1 3
0 no (n/a)
(n/a)
DATA1 decimal 9
18 0 yes (n/a)
(n/a)
DATA2 decimal 9
18 0 yes (n/a)
(n/a)
DATA3 decimal 9
18 0 yes (n/a)
(n/a)
DATA4 decimal 9
18 0 yes (n/a)
(n/a)
DATA5 decimal 9
18 0 yes (n/a)
(n/a)
DATA6 decimal 9
18 0 yes (n/a)
(n/a)
DATA7 decimal 9
18 0 yes (n/a)
(n/a)
DATA8 decimal 9
18 0 yes (n/a)
(n/a)
DATA9 decimal 9
18 0 yes (n/a)
(n/a)
DATA10 decimal 9
18 0 yes (n/a)
(n/a)
DATA11 decimal 9
18 0 yes (n/a)
(n/a)
DATA12 decimal 9
18 0 yes (n/a)
(n/a)
DATA13 decimal 9
18 0 yes (n/a)
(n/a)
DATA14 decimal 9
18 0 yes (n/a)
(n/a)
DATA15 decimal 9
18 0 yes (n/a)
(n/a)
DATA16 decimal 9
18 0 yes (n/a)
(n/a)
DATA17 decimal 9
18 0 yes (n/a)
(n/a)
DATA18 decimal 9
18 0 yes (n/a)
(n/a)
DATA19 decimal 9
18 0 yes (n/a)
(n/a)
DATA20 decimal 9
18 0 yes (n/a)
(n/a)
DATA21 decimal 9
18 0 yes (n/a)
(n/a)
DATA22 decimal 9
18 0 yes (n/a)
(n/a)
DATA23 decimal 9
18 0 yes (n/a)
(n/a)
DATA24 decimal 9
18 0 yes (n/a)
(n/a)
DATA25 decimal 9
18 0 yes (n/a)
(n/a)
DATA26 decimal 9
18 0 yes (n/a)
(n/a)
DATA27 decimal 9
18 0 yes (n/a)
(n/a)
DATA28 decimal 9
18 0 yes (n/a)
(n/a)
DATA29 decimal 9
18 0 yes (n/a)
(n/a)
DATA30 decimal 9
18 0 yes (n/a)
(n/a)
DATA31 decimal 9
18 0 yes (n/a)
(n/a)
DATA32 decimal 9
18 0 yes (n/a)
(n/a)
DATA33 decimal 9
18 0 yes (n/a)
(n/a)
DATA34 decimal 9
18 0 yes (n/a)
(n/a)
DATA35 decimal 9
18 0 yes (n/a)
(n/a)
DATA36 decimal 9
18 0 yes (n/a)
(n/a)
DATA37 decimal 9
18 0 yes (n/a)
(n/a)
DATA38 decimal 9
18 0 yes (n/a)
(n/a)
DATA39 decimal 9
18 0 yes (n/a)
(n/a)
DATA40 decimal 9
18 0 yes (n/a)
(n/a)
DATA41 decimal 9
18 0 yes (n/a)
(n/a)
DATA42 decimal 9
18 0 yes (n/a)
(n/a)
DATA43 decimal 9
18 0 yes (n/a)
(n/a)
DATA44 decimal 9
18 0 yes (n/a)
(n/a)
DATA45 decimal 9
18 0 yes (n/a)
(n/a)
DATA46 decimal 9
18 0 yes (n/a)
(n/a)
DATA47 decimal 9
18 0 yes (n/a)
(n/a)
...
read more »
You have, actually, and perhaps unintentionally, provided some additional
information of importance on this post. I had assumed that you "upgraded"
from SQL Server 6.5 to SQL Server 7.0 using the Upgrade Wizard provided in
SQL Server 7.0. However the Upgrade Wizard would have brought along the
indexes and constraints, so it's clear that you didn't use the Upgrade
Wizard.
From a space viewpoint, the only time NULLs are significant, between SQL
Server 6.5 and SQL Server 7.0 is when one has NULLable char or varchar
columns. NULLable decimal columns just don't really affect size.
BTW, if I might suggest, next time around consider attaching the information
rather than posting it ... it's going to be a lot more readable as an
attachment :-)
Please, try an experiment ... do:
select *
into new_METER_FREEZE_DATA_2001_10
from METER_FREEZE_DATA_2001_10
go
drop table METER_FREEZE_DATA_2001_10
go
exec sp_rename 'new_METER_FREEZE_DATA_2001_10' , 'METER_FREEZE_DATA_2001_10'
and then define a **clustered** index corresponding to the
"indexmeter_freeze_da" index on the SQL Server 6.5 box, and then re-run the
sp_spaceused stored procedure.
Don't repost the table schema information, just post the space used
information.
BTW, if it is at possible, I would suggest using the SQL Server 7.0 Upgrade
Wizard against the SQL Server 6.5 database, and see what the results are.
-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
name rows reserved data
index_size unused
-------------------- ----------- ------------------ ------------------
------------------ ------------------
new_METER_FREEZE_DAT 34295 10048 KB 9978 KB
56 KB 14 KB
I had tried to "upgrade" from 6.5 to 7.0 for times. The two database
are installed in two computer all based on Windows NT 4.0. In the
process of the upgrading, It was said that sql server 6.5 on the
remote computer can't be restarted. So I had to "Import".
Re: the problem with the Upgrade Wizard. Did you use operating system and
SQL Server logins with sufficient permissions? The "best" logins are those
of a domain administrator and SA. Keep in mind that in order to restart SQL
Server, one has to start the SQL Server service. Not even an SA, who lacks
appropriate operating system permissions, can start a service. To WinNT, the
SQL Server service is just another program ... there ain't anything
"special" about it from the viewpoint of the operating system.
-------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
Quote:> I created the new table and a cluster index on it In SQL Server 6.5 (I
> haven't replaced the original table because I think there's no
> diference to this test). I found that the size is a bit smaller than
> before. The result of executing sp_spaceused is as follow:
> name rows reserved data
> index_size unused
> -------------------- ----------- ------------------ ------------------
> ------------------ ------------------
> new_METER_FREEZE_DAT 34295 10048 KB 9978 KB
> 56 KB 14 KB
> I had tried to "upgrade" from 6.5 to 7.0 for times. The two database
> are installed in two computer all based on Windows NT 4.0. In the
> process of the upgrading, It was said that sql server 6.5 on the
> remote computer can't be restarted. So I had to "Import".
However, I ran this script in 6.5, and it seemed to confirmed my beliefs:
use tempdb
go
create table alfons (a decimal(18, 9) NULL)
create table bettan (a decimal(18, 9) NULL)
go
insert alfons
select null
from sysobjects a
cross join sysobjects b
cross join sysobjects c
go
insert bettan
select 12.090904
from sysobjects a
cross join sysobjects b
cross join sysobjects c
go
exec sp_spaceused alfons, true
exec sp_spaceused bettan, true
go
I got the output:
(13824 row(s) affected)
(13824 row(s) affected)
DBCC execution completed. If DBCC printed error messages, see your System Administrator.
name rows reserved data index_size unused
--------- ----------- ------------ --------- ------------ ------------------
alfons 13824 112 KB 108 KB 0 KB 4 KB
DBCC execution completed. If DBCC printed error messages, see your System Administrator.
name rows reserved data index_size unused
--------- ----------- ------------ --------- ------------ ------------------
bettan 13824 254 KB 248 KB 0 KB 6 KB
On SQL2000, the output was
(13824 row(s) affected)
(13824 row(s) affected)
name rows reserved data index_size unused
--------- ----------- ------------ ---------- ------------ ------------------
alfons 13824 328 KB 264 KB 8 KB 56 KB
name rows reserved data index_size unused
--------- ----------- ------------ ---------- ------------ ------------------
bettan 13824 328 KB 264 KB 8 KB 56 KB
Thus, there a radical difference in size on 6.5, but on SQL2000 the
tables are equally big.
--
Erland Sommarskog, Abaris AB
SQL Server MVP
1. Need help on connecting ISQL_w Client (from SQLServer 6.5) to SQLServer 7.0 Server
Dear Everyone,
I have installed the Desktop version of SQLServer 7.0 on Windows 98. I have
some questions/problems as the following:
1) Within this machine I already have ISQL_w (Client program from
SQLServer 6.5) that can connect a SQLServer 7.0 on NT server on the network.
But
this ISQL_w (Client program from SQLServer 6.5) CANNOT connect to desktop
version of SQLServer 7.0 on this Windows 98. Cloud anyone tell me how to do
it ?
2) Can we develop Clinet/Server Applicaiton using ODBC 32-bits with
SQLServer 7.0 on Windows 98. I means both Client program and SQLServer 7.0
are on the same Windows 98 machine ? How can we config ODBC to connect to
the SQLServer 7.0 ?
3) Is it possible to develop 16-bits application using ODBC 16-bits
connect to SQLServer 7.0 on Windows 98. Both Client program and SQLServer
7.0 are on the same Windows 98 as in 2) ? and How can we config this ODBC
16bits to connect to the SQLServer 7.0 ?
I hope anyone of you cloud hlp me. Thank you very mcuh in advance.
Sincerely yours,
Pearapon S.
3. Migrating SqlServer 6.5 database to SqlServer 7.0
4. Metacube - aggregate levels.
5. upgrade problems to ms-sqlserver 7.0 to ms-sqlserver 2000
6. An internal error (22) has occurred from passwdexpired()
7. Upgrade ms sqlserver 7.0 to sqlserver 2000 problems
8. INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS., ARITHABORT'.
9. Trying to upgrade from 6.5 to 7.0 SQLServer
10. SQLServer 6.5 to 7.0 upgrade problems
11. Error trying to increase memory on SQLServer 6.5
12. Running Sqlserver 6.0 and sqlserver 6.5 together
13. SQLSERVER 6.5 Error 10004: Unable to connect to sqlserver