Thursday, May 19, 2011

A nice free addon for SQL management studio, SQL Search 1.0


SQL Server developers and DBAs use SQL Search to:

  • Find fragments of SQL text within stored procedures, functions, views and more
  • Quickly navigate to objects wherever they happen to be on a server
  • Find all references to an object 

http://www.red-gate.com/products/sql-development/sql-search/

How to show time cost for one query in T-SQL?


      DECLARE @starttime DATETIME2 = SYSDATETIME(), @alltime datetime2 = sysdatetime();
      DECLARE @finishtime INT;

/* Your query is in here */

      SELECT @finishtime = DATEDIFF(millisecond, @starttime, SYSDATETIME());
      PRINT '(ms): ' + CONVERT(VARCHAR, @finishtime)