Hello to all,
Below the sample code:
declare @arg_szMsgText ntext
set @arg_szMsgText = isnull(@arg_szMsgText, N'unknown message')
Now the error message I get:
"The assignment operator operation cannot take a ntext data type as an
argument."
Explanation:
I'm using it in a SP. I was trying thousand things to make it running,
and the only way I maked was, I get it when I set the return value from
isnull fucntion to nvarchar or varchar variable.
The problem is, the field in DB, where the value of @arg_szMsgText is
written) is ntext, so I need to use this format.
In the description of isnull function (help) is written:
----------------------------------------------------
Arguments
check_expression
Is the expression to be checked for NULL. check_expression can be of
any type.
replacement_value
Is the expression to be returned if check_expression is NULL.
replacement_value must have the same type as check_expresssion.
Return Types
Returns the same type as check_expression.
-----------------------------------------------------
so ite means, I should be able to use this in such a way ...
I know I can assign the value in other way (like by if @variable is
null ....), but if there is already function doing this, why not to use
it, if it helds the code more clear?
Any ideas? Maybe I'm doing something wrong.
Matik