There was a requirement to delete data from a lot of tables connected with foreign keys without disabling the constrain or using CASCADE feature. Hence…
I have built a Domain controller (SHERBAZ.COM) on Windows 2012 Datacenter edition evaluation version with DNS role enabled. Also I use a trial version Starwind…
If we perform update or delete operation on huge number of rows in a large table at once, there are chances that the SQL Server…
Its quite common that when there is some upgrade, change or release in application, there are chances that our database objects get modified. It may…
Below script helps restore several databases on to a SQL Server instance in one go. We just have to place all the .bak files in…
Problem A few months back, I had shared a script to automate index rebuild/reorg in a database with fragmentation analysis inplace at https://www.sherbaz.com/2013/06/resumable-auto-index-rebuild-and-reorganize-script/. But that…
Problem In all SQL server failover clusters in our environment, It came to our notice that the SQL Server Agent is spamming the Application eventlogs…
One fine morning, users started complaining my SQL server instance performance…They sent me a screenshot which indirectly says, their queries have timed out. I quickly logged…
SELECT v.[id], d.dirname, Count(v.[version]) MaxNumberOfVersions, Sum(v.[size]) TotalDocLibSize, Max(v.[size]) LargestDocSize FROM [dbo].[alldocversions] v JOIN [dbo].alldocs d ON v.id = d.id GROUP BY v.id, d.dirname ORDER BY 4 DESC
SELECT o.name, reservedpages = Sum(a.total_pages), usedpages = Sum(a.used_pages), reservedMB = ( Sum(a.total_pages) * 8 / 1024 ), usedMB = ( Sum(a.used_pages) * 8 / 1024 ), pages = Sum(CASE WHEN a.type <> 1 THEN a.used_pages WHEN p.index_id < 2 THEN a.data_pages ELSE 0 END), rows = Sum(CASE WHEN ( p.index_id < 2 ) AND ( a.type = 1 ) THEN p.rows ELSE 0 END) FROM sys.objects o JOIN sys.partitions p ON p.object_id = o.object_id JOIN sys.allocation_units a ON p.partition_id = a.container_id WHERE o.type = ‘U’ GROUP BY o.name ORDER BY 3 DESC