all groups > sql server (alternate) > december 2005 >
You're in the

sql server (alternate)

group:

Text datatype as local variables in Trigger


Text datatype as local variables in Trigger bhavin.vyas NO[at]SPAM gmail.com
12/12/2005 1:14:30 AM
sql server (alternate):
Friends,

I would just like to know that why SQL Server doen't allow us to define
a text data type local variable while creating trigger?

I tried creating a text variable in a trigger as a local variable and
it raises error.

"Implicit conversion from data type text to nvarchar is not allowed.
Use the CONVERT function to run this query".

For this i have to use convert function in MS SQL Server.

-Thanks
Bhavin Vyas
Re: Text datatype as local variables in Trigger Mike Epprecht (SQL MVP)
12/12/2005 2:43:41 PM
Hi

text, ntext and image data types are not valid as local variables in SQL
Server 7.0, 2000 and 2005.

They are now deprecated in SQL Server 2005, with their replacements being
varchar(max), nvarchar(max) and varbinary(max). Those are valid as local
variables.

text and it's friends were really complicated types and their history is
long and troublesome. It was not practical to allow them as data types for
variables.

Regards
--------------------------------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

[quoted text, click to view]

AddThis Social Bookmark Button