Category Archives: SQL-Server

T-SQL: Find table in complete instance

bschelst/ February 11, 2019/ SQL-Server/ 0 comments

Looking for a table, but you don’t remember in which database it’s located? The code below will create a stored procedure, which you can use in order to find a table in multiple databases.

T-SQL: Kill all connections to a specific database

bschelst/ February 11, 2019/ SQL-Server/ 0 comments

Sometimes you need to do maintenance on a database, and you don’t really want to use single user mode or disable accounts. In that situation you could kill all connections to a specific database.In order to achieve that, you can use the t-sql code below.

SQL-Server: The query processor ran out of internal resources and could not produce a query plan

bschelst/ June 7, 2017/ SQL-Server/ 0 comments

from : http://jasonbrimhall.info/2014/01/02/day-9-queries-going-boom/ The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more

Read More

SQL-Server: Get Server – Edition – Instance Name with T-SQL

bschelst/ March 29, 2017/ SQL-Server/ 0 comments

  The following t-sql statement returns the server name, server instance, instance, edition & version of the running SQL-Server.   SELECT SERVERPROPERTY(‘MachineName’) AS [ServerName], SERVERPROPERTY(‘ServerName’) AS [ServerInstanceName], SERVERPROPERTY(‘InstanceName’) AS [Instance], SERVERPROPERTY(‘Edition’) AS [Edition], SERVERPROPERTY(‘ProductVersion’) AS [ProductVersion], Left(@@Version, Charindex(‘-‘, @@version) – 2) As VersionName