I commonly do a demo when teaching SQL Server 2005 where I write a SQLCLR UDF that's returns the string "Hello World". The define it, sans VS autodeploy, like this.
CREATE FUNCTION somefunc()
AS EXTERNAL NAME MyAssembly.MyClass.MyFunction
When invoked, it returns "Hell", silently truncating the string the CLR sent it. UNTIL Apr CTP. Now its returns "Truncation Exception". Surprise, surprise… After reporting this as a bug, I was told that "That's the way its supposed to work. To prevent silent data loss."
I agree. Except now its works differently than this T-SQL function:
CREATE FUNCTION somefuncT()
RETURN N'Hello World'
Correct again, it does work differently. The idea is the T-SQL one still silently truncates data, but the SQLCLR one does "the right thing". The T-SQL one still works the way it does for backward compatibility only. Maybe in the next release they'll work the same.
So what's your preference, backward compatibility or lack of silent data loss (and exceptions)? Just curious…