Category: SQLServer

  • Introducing JiMetrics

    For the impatient, here is the link to JiMetrics web site, where you can get the scripts and get going. To learn why it is called JiMetrics, you will have to read all the way to the end. During the last couple of years, I’ve been working with health care related BI data warehouse, running […]

  • Install sqlps as a PowerShell module

    Most of SQL Server automation scripts using PowerShell use SMO directly. For example, one would do something like: [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.SMO”) $MyServer = new-object (‘Microsoft.SqlServer.Management.Smo.Server’) ‘HOME’ $MyDataBase = new-object (‘Microsoft.SqlServer.Management.Smo.Database’) ($Server, “MyDataBase”) That’s a lot of typing and looks messy and cumbersome. Since SQL Server 2008, Microsoft provides a sqlps shell which exposes a lot of SQL […]

  • Gathering SQL Server database free space and space usage by schema

    I did analysis for SQL Server database free space and space usage by schema twice in the last few months, without any outside monitoring tools. I wrote this down here for future reference. A significant part of the code came from this article here by The MAK, with slight modification. And I’ve verified that it […]

  • One example of query performance problem due to data type conversion

    In many RDBMS systems, if the value(s) passed to a query for filtering/matching is of different data type than the column data type it is comparing against, an implicit data conversion occurs. This conversion can render the index defined on said column(s) less useful or entirely useless. I encountered one such problem on SQL Server […]

  • ALTER LOGIN after Windows user or group name has been changed

    If a Windows AD group or user has been renamed, and if that group or user was granted access to SQL Server in the past, then you can use ALTER LOGIN to rename the login inside of SQL Server: ALTER LOGIN [myDomain\oldName] WITH NAME = [myDomain\newName] It is not necessary to adjust user names in […]