SQL trigger and DataType "text"
Posted on 2012-08-15
I have a table (tblInfo) with a field called "info". This field has DataType = text.
The table has a SQL Trigger that needs to do a select from the "info" field. Because of the DataType (text) I get this error:
[Cannot use text, ntext, or image columns in the 'inserted' and 'deleted' tables]
Here is my code:
ALTER TRIGGER [dbo].[trgHandler]
SET NOCOUNT ON
DECLARE @msg varchar(4)
DECLARE @info varchar(max)
SET @msg = (select msg from INSERTED)
SET @info = (select info from INSERTED) -- THIS FAILS!
IF (@msg = '1234')
-- Do something with @info here...
My question is: How can I get the text from the "info" field in my SQL trigger?