ntext to nvarchr(max)

  • for transfering data from one data base to another data base i used the Trigger

    here is the schema of Source table:

    Id int

    Title varchar

    Body ntext

    and the schema of Desination table:

    Id int

    Title varchar

    Body nvarchar(max)

    and the Trigger:

    ALTER TRIGGER [TRG993]

    ON [dbo].[Table_1]

    AFTER INSERT

    AS

    BEGIN

    SET NOCOUNT ON;

    INSERT INTO DBntext2.dbo.Table_1 (Id, Title, Body)

    SELECT a.Id, a.Title, CAST(a.Body as nvarchar (MAX))

    FROM DBnetxt1.dbo.Table_1 a, inserted b

    END

    but i have aquestion :

    Now the Trigger works successfully, but for tranfering very large amount of data ( in the field wich name is Body and its data type is ntext) does it work successfuly again?

    because i have heard something about sp_Table option and ( text in row)?

  • Why a trigger to move data from one database to another?

    That trigger's got a cross join in it. You have no join between the inserted table and the main table. If someone inserts 4 rows, you're going to get 4 complete copies of Table1 inserted into the other database. Is that what you want?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Please don't create new threads for existing problems. There have been lots of answers to your questions on the other thread you started on this.

    Please continue discussion on the following thread: http://www.sqlservercentral.com/Forums/Topic613486-266-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply