Scripts

Technical Article

Who's Blocking

A quick little standalone script that tells you what process is blocking and what processes the blocking processing actually blocking.When running this script in QA, change your output to "Results in Text" ( CTRL-T ).  Utilizes the blocking info in sp_who2 combined with dbcc inputbuffer and a little cursor to wrap it all up.  Formatting […]

2.33 (3)

You rated this post out of 5. Change rating

2007-04-19 (first published: )

7,447 reads

Technical Article

Dynamic SQL inside User defined functions

The script details about the workaround for using Dynamic SQL inside T-SQL user defined functions. Basically, T-SQL doesn't allow developers to perform/write any actions/statments which would affect the database's state. As a key note factor for any migration process from oracle to sql server developers need to do a work around on using execute immediate(for […]

3 (2)

You rated this post out of 5. Change rating

2007-04-18 (first published: )

4,015 reads

Technical Article

What's Running

spWhatsRunning does just that.  It tells you exactly what is executing on your server.  By combining the output of the sp_who and dbcc inputbuffer, this script will tell you exactly whats being executed.  DBCC INPUTBUFFER will tell you the same thing, but by the time you get the spid, the offending process may be gone.  […]

You rated this post out of 5. Change rating

2007-04-17 (first published: )

2,725 reads

Technical Article

UDF for date ranges around a given date (updated)

UDF - SQL 2000 and higherThis function returns an 18 row table of date ranges around a given date.The ranges are: Day, Week (Sunday to Saturday), Month, Quarter, Half Year, Year.For each range there are 3 values: Previous, Same and NextExample of usage:Joined to an orders table:Select r.period, count(o.order_id)from orders oinner join dbo.ufn_date_ranges('2003-04-01') ron o.order_date […]

You rated this post out of 5. Change rating

2007-04-12 (first published: )

484 reads

Technical Article

Query Hierarchical data Using CTE in T-SQL 2005

In response to Sam Stange's "An old and new way to query Hierarchical data", this script uses the new CTE feature of SQL Server 2005 to display the hierarchical data all at once. I have added a check to prevent infinite loop in case there is a loop in the data (actually, there is one […]

3.67 (3)

You rated this post out of 5. Change rating

2007-04-11 (first published: )

1,431 reads

Technical Article

Function Based Index in T-SQL

To build function based index in SQL Server, you can use indexed view (materialized view) or using a computed column. In this script, I give an exmaple of how to use the computed column to implement a function based index on a table to search through a free formated telephone number column. The basic step […]

5 (3)

You rated this post out of 5. Change rating

2007-04-10 (first published: )

8,697 reads

Technical Article

Script to aid in Indexing Strategy

When AUTOSTATS is used in a database, we can sometimes use these automatically generated statistics to find columns where SQL Server has built statistics on non-indexed columns that may benefit from an index. This script finds these columns and displays the selectivity of them. This script can be useful in troubleshooting poorly performing databases by […]

5 (1)

You rated this post out of 5. Change rating

2007-04-09 (first published: )

1,743 reads

Technical Article

Maintenance Plan Cleanup Proc

If you use 2 different maintenance plans (one for full-recovery databases and one for simple-mode databases) this proc can help keep the databases in the right plan. You can schedule this as a job and if anyone changes the recovery mode of a database or adds/removes a database, this proc will ensure that the changes […]

You rated this post out of 5. Change rating

2007-04-06 (first published: )

1,617 reads

Blogs

SQL Server Distributed Availability Groups and Kubernetes

By

A while back I wrote about how to use a Cross Platform (or Clusterless)...

Webcast Tomorrow on SQL Server Disaster Recovery

By

Tomorrow, November 19, 2024, at 1 PM EST, I'm giving a webcast on SQL...

SQL Server Quickie #48 – Azure SQL Managed Instance

By

Today I have uploaded SQL Server Quickie #48 to YouTube. This time I’m talking...

Read the latest Blogs

Forums

SSMS 20.2 on Windows11 not able to connect to SQL 2005 ??

By Johan Bijnens

We still have a couple of dino's. What should I check to re-enable access...

Agent job security account

By onkarnath.tiwary

Hi All, I have few sql server agent scheduled jobs which are supposed to...

How to manage Time zone changes for countries

By gauravkumar9

Hello Everyone, I am using Microsoft SQL Azure (RTM) - 12.0.2000.8, as of October...

Visit the forum

Question of the Day

What's the Ceiling?

What do I get as the results from this code?

SELECT CEILING (999.999), CEILING (-999.999);

See possible answers