How to convert NTEXT to NVARCHAR(MAX)
Posted: April 30, 2012 Filed under: SQL Server 2008, SQL Server 2012 Leave a commentJohn Conwell has a post about the issues associated with the conversion of NTEXT to NVARCHAR(max) in SQL Server 2005 back in 2008. http://geekswithblogs.net/johnsPerfBlog/archive/2008/04/16/ntext-vs-nvarcharmax-in-sql-2005.aspx
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.
ALTER TABLE testTable ALTER COLUMN testText NVARCHAR(MAX) null
Do this:
UPDATE testTable SET testText = testText
GROUPING SETS in T-SQL— Post Links
Posted: April 17, 2012 Filed under: SQL Server 2008, SQL Server 2012 Leave a commentI have read this post from Craig Freedman about GROUP SETS function in SQL Server 2008, which is well written and easy to understand.
http://blogs.msdn.com/b/craigfr/archive/2007/10/11/grouping-sets-in-sql-server-2008.aspx
If you need more detail about this function, you can check the document from Books Online:
http://msdn.microsoft.com/en-us/library/ms177673.aspx
IIS 7.5 Error Caused by Adding mimeMap to DNN Site (Duplicate Entry for the same mimeType)
Posted: April 5, 2012 Filed under: Uncategorized Leave a commentWhen 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)
<pre><staticContent>
<mimeMap fileExtension=”.mp4″ mimeType=”video/mp4″ />
</staticContent></pre>
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.”
<pre><staticContent> <remove fileExtension=".mp4" /> <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> </staticContent></pre>
Fill Form Hidden Field with Querystring Paramater
Posted: April 5, 2012 Filed under: jQuery/Javascript Leave a commentI 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.
http://www.webmasterworld.com/javascript/4313611.htm
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);