How to convert NTEXT to NVARCHAR(MAX)

John Conwell has a post about the issues associated with the conversion of NTEXT to NVARCHAR(max) in SQL Server 2005 back in 2008.

The observation and fix he found in SQL Server 2005 is still true in SQL Server 2008 and SQL Server 2012.

Here is the the tak aways from his post which still apply to SQL Server 2008/2012:

You need to do an UPDATE to the column which is converted from ntext to nvarchar(max) after the alter table alter column statement.



Do this:
UPDATE testTable SET testText = testText



I have read this post from Craig Freedman about GROUP SETS  function in SQL Server 2008, which is well written and easy to understand.

If you need more detail about this function, you can check the document from Books Online:


IIS 7.5 Error Caused by Adding mimeMap to DNN Site (Duplicate Entry for the same mimeType)

When you add mimeMap type to IIS site, there is an entry to be added to the applicationHost.config (You can see this file with Notepad from Win 2008 view All Files:
c:\windows\system32\inetsvr\config\applicationhost.config ).
(For example, we are adding .mp4 type)



<mimeMap fileExtension=”.mp4″ mimeType=”video/mp4″ />


When you add mimeMap type to your Web application directly, IIS will add one entry to the web.config file.

If you add the same mimMap fileExtention to the site and your web application, you may run into problem you may not see it before.
In our case, the site stops to load scripts (javascript and css) and all navigation and image path are screwed. It was a pretty hard to identify the issue due to unclear error message.

When we find out the issue, the cure is to comment out the entry from web.config file. I have seen a better solution to use the [remove] syntax in web.config file to fix the problem. ”Doing the remove before the add should be fine even when the .xyz mime map doesn’t exist at a higher level.”

        <remove fileExtension=".mp4" />
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />

Fill Form Hidden Field with Querystring Paramater

I have need to populate a hidden field on a Form with a value from incoming querystring with javascript.
I used the script I found from this thread to get the job done.

function getquerystring() {
    var url = location.href;
    if (url.split('?')[1] != undefined) {
        var qs = url.split('?')[1];
        String.prototype.splitquerystring = function () {
            return this.split(/[=&]/);
        document.getElementById('promocode').value = qs.splitquerystring()[1];

//        for (var c = 1; c < qs.splitquerystring().length; c += 2) {

//            document.getElementById('inp' + c).value = qs.splitquerystring()[c]; 
//        } 

window.addEventListener ? window.addEventListener('load', getquerystring, false) : window.attachEvent('onload', getquerystring);