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

November 2008 Entries

I needed to schedule a task to run every day at 9:00 p.m. in the night. I had an addition al requirement that the task be scheduled only if the FileSystemwatcher alerts us of new files being available for processing. Thus the files could be recieved anytime during the day, but despite that the task should be schduled to run exactly at 9:00 p.m. in the night. So I used the following code to schedule a task(using System.Threading.Timer and TimeSpan classes) DateTime d = DateTime.Now; timer = new Timer(new...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

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...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

If you need to Convert SQL 2005 DB TimeStamp values to Long then follow these steps: 1. Retrieve the DB TimeStamp value in a Byte Array (8 bytes long). 2. Convert the byte array into a Hexadecimal string 3. Convert the hexadecimal string to a long private long BytesToLong(byte[] bytes) { string ts = null; foreach (byte b in bytes) ts += b.ToString("X").PadLeft(2,C... return Convert.ToInt64(ts, 16); } There is another method to convert the DBTimeStamp to Long, but I dont prefer this...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati