When Microsoft or Google CDN fails, what should u do?


Let me tell you one thing, an outage in CDN is very rare. But just in case you don’t want to take a risk, go ahead with this fallback mechanism, as suggested by Scott Guru.
Microsoft CDN outage for jQuery:
<script type=”text/javascript”>
if (typeof jQuery == ‘undefined’)
document.write(unescape(“%3Cscript src=’/Scripts/jquery-1.4.2.min.js’ type=’text/javascript’%3E%3C/script%3E”));
Microsoft CDN outage for AJAX:

<script src=”http://ajax.microsoft.com/ajax/3.5/MicrosoftAjax.js&#8221; type=”text/javascript”></script>
<script src=”http://ajax.microsoft.com/ajax/mvc/1.0/MicrosoftMvcAjax.js&#8221; type=”text/javascript”></script>
<script type=”text/javascript”>
if (typeof Sys == ‘undefined’)
document.write(unescape(“%3Cscript src=’/Scripts/MicrosoftAjax.js’ type=’text/javascript’%3E%3C/script%3E”));
document.write(unescape(“%3Cscript src=’/Scripts/MicrosoftMvcAjax.js’ type=’text/javascript’%3E%3C/script%3E”));
Use it for any CDN’s.
Let your mind be at peace.. ūüôā


Convert a comma separted list to a table in SQL

I thought of sharing this simple function that you can use for splitting a list or nvarchar(max) or anything that is coma separated and sent to DB, into a temp table.


Performance is a bottle neck for us. As for that matter, for any SP executions. We cannot live with the IN operator. It is always advicable to go ahead with SET based operations like JOINs in these cases. They also have a good track record of showing an improved performance to a greater extend.

If you need to have such a list in a table format, it is always advicable to have a generic function in your DB to handle such operations, as you might have such scenarios coming up in other SPs also.

Adding the SplitList Function to fulfil the above requirement is shared below:

CREATE FUNCTION [dbo].[SplitList]   
 @List nvarchar(max),   
 @SplitOn nvarchar(5)   
RETURNS @RtnValue table    
 Id int identity(1,1),   
 Value nvarchar(100)   
While (Charindex(@SplitOn,@List)>0)   
Insert Into @RtnValue (value)   
    Value = ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1)))    
    Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))   
Insert Into @RtnValue (Value)   
    Select Value = ltrim(rtrim(@List))   

–declare @tempList nvarchar(max)
–set @tempList = ‘1,2,3,4,5,6,7,8,9,10’

–select VALUE FROM dbo.SplitList(@tempList,’,’) — Remember, this will give you a table.. so store this statement into a temptable


Run the above function in your DB and you can start using the split list operation. Check the last 3 statements to see the usage of this function.

You normally should do

INSERT INTO @tbl_MyTempTable (ListValue)

SELECT VALUE FROM dbo.SplitList(@tempList,’,’) — my list is a coma separated one..

The above @tbl_MyTempTable will have my list (‘1,2,3,4,5’) stored as each rows..

Hope this was helpful…