Rohit Gupta

Engaging talk on Microsoft Technologies ....My Resume

  Home  |   Contact  |   Syndication    |   Login
  39 Posts | 0 Stories | 52 Comments | 0 Trackbacks

News



Twitter












Archives

Image Galleries

Personal

Thursday, November 13, 2008 #

DECLARE @check1 bigint
DECLARE @check2 bigint

Select @check1 = CHECKSUM_AGG(CHECKSUM(*))
FROM
(
    SELECT *
    FROM dbo.Orders (nolock)
)
AS Source

Select @check2 = CHECKSUM_AGG(CHECKSUM(*))
FROM
(
    SELECT *
    FROM dbo.Orders (nolock)
    WHERE IsSuccessful = 1
)
As Comparison

IF @check1 = @check2
    PRINT 'Queries are Equal'
ELSE
    PRINT 'Queries are NOT Equal'
Note: If order of rows is different it will not effect the result It does not do execution plan comparisons, simply checks if the rows returned by the two queries are the same or not More info
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati