Advertisement

06.21.2007 at 02:43AM PDT, ID: 22648082
[x]
Attachment Details

Reclaim free space in data after changing fields from NVARCHAR to VARCHAR?

Asked by gbshahaq in MS SQL Server

Tags: ,

SQL 2000:

how do I reclaim free space in data after changing fields from NVARCHAR to VARCHAR?
I have the following:

2 identical tables (tbl1, tbl2) of one column of data for testing purposes - one created as varchar(100), tbl2 with nvarchar(100), and both with a string of 7 chars (like 'aaaaaaa') - each with same number of rows.

ran sp_spaceused on both, confirmed tbl2 took up about 35% more space (1760 vs 1304)
I then ALTER TABLE on tbl2 to amend the data type to varchar, expecting a drop in data size.
nothing
i checked DATALENGTH had changed from 14 to 7 on tbl2, so there were no "hidden" chars being stored. I ran DBCC CLEANTABLE - made no difference.
I tried DBCC SHRINKDATABASE and DBCC SHRINKFILE - also made no difference.
I even tried creating a clustered index, running DBCC INDEXDEFRAG and then dropping the index - also no difference.

DBCC SHOWCONTIG reports a page density of around 73% for tbl2 - tbl1 has over 98% - so how do i get the db to shift the space around to fill the pages, and remove the empty ones, and give me my space back?!Start Free Trial
[+][-]06.21.2007 at 02:53AM PDT, ID: 19331642

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:06AM PDT, ID: 19331693

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:11AM PDT, ID: 19331699

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:39AM PDT, ID: 19331792

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:41AM PDT, ID: 19331801

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:42AM PDT, ID: 19331804

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:48AM PDT, ID: 19331825

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.21.2007 at 03:59AM PDT, ID: 19331889

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.01.2007 at 08:30AM PDT, ID: 19399311

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 01:54AM PDT, ID: 19402035

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 02:53AM PDT, ID: 19402210

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 02:59AM PDT, ID: 19402223

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 03:39AM PDT, ID: 19402299

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 03:43AM PDT, ID: 19402312

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.02.2007 at 03:59AM PDT, ID: 19402363

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: reclaim, sql
Sign Up Now!
Solution Provided By: twoboats
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.02.2007 at 04:35AM PDT, ID: 19402485

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2007 at 01:16AM PDT, ID: 19409516

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2007 at 01:27AM PDT, ID: 19409566

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32