Scripts

Technical Article

Full, diff and tlog backups based on recovery mode

    This a script which creates stored procedures that can be executed adhoc or set as sql agent jobs to check the recovery status and generate full, differential or transaction log backupf for each database if the database recovery status is set to full.  We have terabytes of data and set all production databases […]

You rated this post out of 5. Change rating

2003-06-06

925 reads

Technical Article

blocked  and blocker  spid and details

2 steps:step 1 => create   a table in master database called BlockCheckstep 2 =>  create the stored procedure in master  called  BLOCK_CHECK @database_name varchar(20)What SP  does:-    it gets the  spid that is blocked  + info about it (like what it does  at the moment  it is blocked)-    it gets the spid  that  acts as a […]

4 (1)

You rated this post out of 5. Change rating

2003-06-05

722 reads

Technical Article

Improving performance on joins to large tables.

In your tenure as a DBA/developer, you've probably been asked to write dozens of stored procedures similar to this:CREATE PROCEDURE ContactInfo@ContactID intASSELECT c.Name, a.Address, p.PhoneFROM Contact cLEFT JOIN ContactAddress aON c.ContactID = a.ContactIDLEFT JOIN ContactPhone pON c.ContactID = p.ContactIDWHERE c.ContactID = @ContactIDBut there is a more efficient way to write such a query.....particularly if you […]

4 (1)

You rated this post out of 5. Change rating

2003-06-03

1,410 reads

Technical Article

Find Duplicate Employees, Customers, Etc.

Customers, employees, etc. come and go.  They get entered multiple times in inconsistent formats in databases.This simple script finds the duplicates across multiple formats and is easily modified as needed.  It's so easy, my grandmother could do it. Oops! No offense Grandma.For very large databases, create and join two temp tables indexed on the namedatetring […]

You rated this post out of 5. Change rating

2003-05-30

204 reads

Technical Article

Show all User-Defined Datatypes for all Databases

This procedure displays all user-defined datatypes in all databases on a server.  Another example of the power of dynamic T-SQL, this procedure dynamically generates SELECT statements for the systypes tables in each database and UNIONs them together so that they display in one recordset.

You rated this post out of 5. Change rating

2003-05-30

152 reads

Blogs

A New Word: Ochisia

By

ochisia – n. the fear that the role you once occupied in someone’s life...

Create a Numbers Table in Power Query

By

This is a quick blog post, mainly so I have the code available if...

Microsoft finally adds Tenant Switcher for Fabric / Power BI

By

Praise whatever deity you believe in, because it’s finally here, a tenant switcher for...

Read the latest Blogs

Forums

It's The People

By Grant Fritchey

Comments posted to this topic are about the item It's The People

To View or not to View, that is the question...

By pietlinden

I've read lots of the horror stories about nested views in databases where they're...

Grant user read-write permission to a single database

By PJ_SQL

Hello! How do I grant a user to read-write to a single database and...

Visit the forum

Question of the Day

The Density Vector

When building statistics, there is the concept of density that refers to the duplicates in a table. How is this calculated?

See possible answers