Month: April 2012

Quick script to set the database owner using powershell. Sure, you could do this in t-sql by just using EXEC sp_changedbowner, but where’s the fun in that? Also, you can do multiple databases with this one. Take that T-SQL!

On the table and index organization page in the sql server documentation link here, under the Allocation Units section, the documentation states:

Each table that has at least one LOB column also has a row in sys.partitions with index_id > 250.

Whilst looking for sparsely populated image columns in one of my tables that’s taking up waay too much room I noticed that said table does indeed contain a LOB column (image data type), yet has no index listed in sys.partitions with an index_id > 250.

Here is the results from querying the sys.partitions table:

Here’s the allocations from the sys.system_internals_allocation_units table. Obviously a bunch of unused space in this table.

Is the documentation wrong? Why you sys.partitions no have index_id > 250 for image column?