Mar 13, 2012 | Microsoft SQL Server, SQL Server 2012, TSQL
SQL Server 2012 introduces two new analytical functions FIRST_VALUE and LAST_VALUE. FIRST_VALUE returns the first value in an ordered set of values and LAST_VALUE returns the last value in an ordered set of values The syntax for these functions are: FIRST_VALUE... Mar 9, 2012 | Microsoft SQL Server, TSQL
T-SQL script to refresh all VIEWS in DATABASE. declare c cursor for select name from sysobjects where type = ‘v’ and uid = 1 open c declare @ViewName varchar(500) fetch next from c into @ViewName while @@fetch_status = 0 begin BEGIN TRY exec sp_refreshView... Mar 9, 2012 | Microsoft SQL Server, SQL Server 2005, TSQL
SQL 2005 System Objects for getting information about Transaction Locks sys.dm_tran_locks: Shows us all locks held on all resources for all transaction. We start from this view since we want to get information about locked resources. sys.partitions: Contains... Mar 9, 2012 | Microsoft SQL Server, SQL Server 2005, SQL Server 2008, TSQL
T-SQL script to enable Cross Database Chaining in Microsoft SQL Server through query analyzer: Use [MY_DATABASE_NAME] GO ALTER DATABASE [MY_DATABASE_NAME] SET DB_CHAINING ON GO EXEC sp_grantdbaccess ‘GUEST’ GO Grant CONNECT to GUEST GO Grant SELECT to... Mar 6, 2012 | Microsoft SQL Server, SQL Server 2005, SQL Server 2008, TSQL
Your SQL Server production database must be available 7×24 but it contains millions of obsolete rows which hurt performance. How do you delete these rows without the lock contention and business impact of a standard delete? In this tip we look at how you can... Aug 22, 2011 | Microsoft SQL Server, SQL Server 2005, SQL Server 2008, TSQL
Here are few important TSQL queries to get the long running transactions and queries in TempDB for monitoring purposes. Long-running transaction: Sometimes transactions may run for long time preventing the shrinking of version store data. The below queries will list...
Recent Comments