DucDigital for ( $girl = 1; $girl < $required; $girl++ ) { echo “I love DucDigital”; }

22Dec/090

NVARCHAR(MAX) now…

Recently, I need to write a Trigger to duplicate and save a copy of revision automatically into the database, and at that time, i encoutered an error:

Cannot use text, ntext, or image columns in the ‘inserted’ and ‘deleted’ tables.

This cause me so much trouble since what else should i use if I am not allowed to use text/ntext? This make me wandering around google for a while, and finally there is a solution...

The NTEXT, TEXT, IMAGE is deprecated since 2005 and will be remove in the future release, maybe 2008R2 since MSSQL2008 still work fine with NTEXT, TEXT

  • NTEXT -> replaced by NVARCHAR(MAX)
  • TEXT -> replaced by VARCHAR(MAX)
  • IMAGE -> replaced by VARBINARY(MAX)

And of course, for those who wondering, the maximum limit of VARCHAR is 8000 and NVARCHAR is 4000 (2 bytes for each unicode character) due to SQL Server uses 8KB page to store data to disk. But of course, Varchar(MAX), NVarchar(MAX) and VarBinary(MAX) data types in SQL Server 2005 which allows you to save upto 2GB in a single variable. The best part is that It allows you to use these data types as stored procedure parameters, internal variables etc.

So I suggest you should stop using NTEXT and TEXT and switch to NVARCHAR/VARCHAR soon!

  • Share/Bookmark
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.