Strange Experience in MSSQL Server with ‘substring’ and ‘len’ Functions

As of all DBA a me too is a great FAN of MS SQl Server for its Flexibility, stability and versatility , though recently i experienced a strange walthrough while i was into simple string functions with length and Substring extractions

As of all DBA a me too is a great FAN of MS SQl Server for its Flexibility, stability and versatility , though recently i experienced a strange walthrough while i was into simple string functions with length and Substring extractions

my requirement is simple one to extract a portion from a defined string , for this i have to use length of another defined string and use it as first parameter

in detail…

select substring(‘abcdefgh’,1,1)

this will return ‘a’

now insted of first ‘1’ i replace length of string function as below

select substring(‘abcdefgh’,len(‘b’),1)

ir returned a null

how this happened….

But again when i tried on a different machine it worked well , i am still in a dialema how the first one happened and at that time all the procedures written was not with this kind of line but i am pretty sure it happened

abhilash

abhilash, is a programmer by profession and a technology addict with a passion towards browsing , shopping and imaging . My views may be biased on reviews. all images and videos are copyrighted to respective owners.

Add comment

Your Header Sidebar area is currently empty. Hurry up and add some widgets.