sp_diff

You may recall from Chapter 4 that we wired VSS's difference-checking tool into Query Analyzer's tools menu so that you could difference check T-SQL scripts. Sp_diff takes a similar approach. It calls VSS's command-line interface, SS.EXE, and accesses its differencing engine to check the differences between two files that you supply. It returns the differences VSS finds between the files as a result set. Here's the code (Listing 21-2):

Listing 21-2. sp_diff.
 USE master GO IF OBJECT_ID('sp_diff') IS NOT NULL DROP PROC sp_diff GO CREATE PROC sp_diff @file1 sysname='/?', @file2 sysname=NULL /* Object: sp_diff Description: Returns the differences between two text files as a result set (uses VSS) Usage: sp_diff @file1=full path to first file, ...

Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.