INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Decreased column size in a table but table size grew

Decreased column size in a table but table size grew

(OP)
Hi!

I have a table temp with path varchar(1000). I reduced the path size with:

CODE

alter table temp
alter column temp varchar(500) 

After I did this the table size actually grew. I reduced again to varchar(4000 and the table size grew again.

Is there another action I should take after adjusting the column size? I was hoping to reduce the size of the table, but it is increasing.

Thanks!

RE: Decreased column size in a table but table size grew

looks like a heap table. Normal to behave like that.

do "alter table temp rebuild" and see how it goes - and with very few exceptions Heaps in SQL Server are not the best for a table - adding a cluster index is normally advisable and will most likely also solve the issue you see here.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: Decreased column size in a table but table size grew

How do you measure table size? There are many possibilities and you need to know how to interpret them.

The ldf size will most certainly rise, as you cause a large transactions with this table change. This can only shrink after log backups and shrinking the ldf, which also needs your luck of the active internal portion of the ldf not to wrpa around from end of file to begin of file.

An even if ata can be stored in less pages within the mdf, that also doesn't automatically shrink it. But you certainly free pages for use of other data storage.

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close