Posts

Showing posts from September, 2012

SQL Server Data Compression Prediction

Following script will generate prediction for data compression in 3 different levels (Database level, Table level, Index level).


DECLARE @estimation table(ObjectName nvarchar(100),SchemaName nvarchar(10),IndexId int, PartitionId int, CurrentSize bigint, NewSize bigint, SampleCurrentSize bigint, SampleNewSize bigint, CompressionMode nvarchar(10) null);

DECLARE @TableName nvarchar(100);
DECLARE  TABLE_CURSOR cursor for
SELECT name FROM sys.objects where type = 'U'
OPEN TABLE_CURSOR
FETCH NEXT FROM TABLE_CURSOR into @TableName;

WHILE(@@FETCH_STATUS = 0)
BEGIN

INSERT INTO @estimation (ObjectName,SchemaName,IndexId,PartitionId,CurrentSize,NewSize,SampleCurrentSize,SampleNewSize)
EXEC sp_estimate_data_compression_savings 'dbo',@TableName,NULL,NULL,ROW;
UPDATE @estimation SET CompressionMode = 'ROW' WHERE CompressionMode IS NULL;
INSERT into @estimation (ObjectName,SchemaName,IndexId,PartitionId,CurrentSize,NewSize,SampleCurrentSize,SampleNewSize)
EXEC sp_estimate_data…

Jquery - Close opened dialog box

Following javascript can be used to close any open dialog.


function CloseCurrentPopup() {
    var diag = $(".ui-dialog");
    var close = $(".ui-icon-closethick", diag);
    close.click();
    $(".ui-dialog").dialog("close");
}