hello
im trying to transfer data from one data base into another database with a Trigger , but there is a problem , the only difference between two tables (Source and Destination) is a field that its name is Body (in Source table and Destination table) but data type of Body in Source table is ntext and data type of Body in Destination Table is nvarchar(max)
the schema of these two table is this"
Source table:
Id int
Title nvarchar(25)
Body ntext
and Destination :
Id int
Title nvarchar(25)
Body nvarchar(max)
and this is my Trigger:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER TRIGGER [TRG993]
ON [dbo].[Source]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO DBntext2.dbo.Destination (Id, Title, Body)
SELECT Id, Title, CAST(Body as nvarchar (MAX))
FROM DBnetxt1
END
but it does not work,
i dont know that there is aproblem in my Trriger or this is because transfering data from a field with ntext typeto a field with nvarchar(max).
regards.