Posts

Showing posts from 2014

XSL1.0 String.Replace() is missing! How can that be achieved?

A couple of months ago, one of my team members, Ali Chaudhary dealt with an issue for which XSL 1.0 is in place and couldn't really figure out the String replacement feature in it .. until he hit the following URL .. seems there is always a way to achieve what you want to ...  http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx

Using T-SQL Convert LOCAL datetime to UTC datetime value using UTC offset (defined)

While working on some things recently, I figured there is an easy way to convert (using T-SQL) local time to UTC departure time … and that is leveraging built-in DATEADD function   Reference http://technet.microsoft.com/en-us/library/ms186819.aspx The key is using the right offset value for calculating UTC .. in the scenario that we dealt with, the database has Offset defined in minutes and is based on the offset/difference in minutes FROM UTC time so to convert the captured local date time to UTC.. the following works just fine .. DATEADD ( mi , - < UTCOffsetValue> , <LOCALDateCaptured> )    // mi - minutes As an example for offset, Canada EST (with Daylight) has the value for the Offset defined as -300 [5 hours behind of UTC] whereas for France it is defined as + 60 [1 hour ahead of UTC]

SQL Server database is Case In-Sensitive - is a MYTH!

The case sensitivity or insensitivity depends on the collation applied to the column or at the DB level .. Normally, the default collation is ‘CI’ but please remember it is not always ‘Case Insensitive’  If you run the below query on any particular db server .. SELECT SERVERPROPERTY ( 'COLLATION' )   what you could retrieve the data value, normally would be,  Latin1_General_CI_AS  (CI – Case Insensitive, AS – Accent Sensitive) But it could also be something like this …   Latin1_General_CS_AS  (CS – in this case, it is Case Sensitive)        So though it may take an additional 1/100 th of a nano-second, I'd generally prefer to UPPERize the string comparison such as below … UPPER(SUBSTRING ( COMMENT_ , 1 , 8 )) = ' Schedule '  instead of exact match such as SUBSTRING(COMMENT_, 1, 8) = 'Schedule'