Selected Tweets of Year 2013!

Another year has come to an end. Being faithful to the “tradition” of posting the last day of every year my selected tweets for the year that ends, here I am again, posting the “Selected Tweets of Year 2013!”. 2013 was remarkable, especially when it comes to Community. Interacting with you, the SQL Server Community … Read more…

Monitoring Locking in SQL Server

SQL Server, has a specific dynamic management view (DMV) which provides detailed information regarding the active locks within the SQL Server instance that is, locks that have been already granted or they are waiting to be granted. The DMV is called: sys.dm_tran_locks.   Using the sys.dm_tran_locks DMV for Monitoring Locking in SQL Server The following … Read more…

Massively Detaching and Re-attaching Databases in SQL Server

In this article, we will be discussing about massively detaching and re-attaching databases in SQL Server.   Why massively detaching and re-attaching all the databases in a SQL Server instance? There are cases where you might need to massively detach and re-attach all the databases in a SQL Server instance. Such scenario can be a … Read more…

T-SQL Tip: Inserting Leading Characters to a String

This post, is actually a T-SQL tip, on how to easily insert leading characters to a string. The Scenario for Inserting Leading Characters Consider that  you have a fixed-length table column for which you want to add leading characters, so that all its records, values with the same number of characters. How to Insert Leading … Read more…

T-SQL Tip: Retrieving Security-Related Info for SQL Server Logins

—— Retrieves Security-Related Information— for all the SQL Server Logins—— SQL Server versions  supported: SQL Server 2005 or later—SELECT [name] as LoginName,LOGINPROPERTY ([name] , ‘DefaultDatabase’) as DefaultDatabase,LOGINPROPERTY ([name] , ‘DaysUntilExpiration’) as DaysUntilExpiration,(CASE ISNULL(LOGINPROPERTY ([name] , ‘IsExpired’),0) WHEN 0 THEN ‘False’ ELSE ‘True’ END) as IsExpired,(CASE ISNULL(LOGINPROPERTY ([name] , ‘IsLocked’),0) WHEN 0 THEN ‘False’ ELSE ‘True’ END) … Read more…

Selected Tweets of Year 2012!

Hello friends, Another year has come to an end and as being faithful to the “tradition” of posting in the last day of every year my selected tweets for the year that ends, here I am, posting the “Selected Tweets of Year 2012!“. It was another great year of interaction with you, the SQL Server Community. … Read more…

T-SQL Tip: Getting the File Locations for all DBs in a SQL Server Instance

—— Dynamically builds  T-SQL statements for retrieving the file — locations for all the databases in the SQL Server Instance—— SQL Server versions  supported: SQL Server 2005 or later—SELECT ‘use ‘+ [name]+’; select ”’+[name]+”’ as DBName,cast ([name] as varchar(45)) as LogicalFileName,cast (filename as varchar(100)) as FileName from sysfiles;’ as SQLStatement FROM master.sys.databases Details: Just execute the statements generated … Read more…

Internal Query Processor Error: The query processor could not produce a query plan

OK folks, it did happen at some point, to get this error message: Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services.   Reproducing the Internal Query Processor Error Message I was trying to execute the following query: SELECT *  FROM dbo.tbl1 WHERE  tbl2ID=(SELECT … Read more…

Handling Disk Space Issues During Heavy Index Rebuild Operations

There are times where you need to massively rebuild indexes on some really large databases, after indicated by the relevant analysis of course. However, rebuilding indexes, requires also the adequate amount of free disk space that will be used during the rebuild operation (mainly for the sorting process). Usually the required space is the size of … Read more…