• hello everyone

    i appreciate yr comments sorry for being late to reply

    well , i havent tried any option yet , other than bcp command and here the code did it a month a go but could go will tell u the reason :

    code on sqlserver:

    ALTER trigger [dbo].[trig1]

    ON [dbo].[t3] after INSERT

    AS

    BEGIN

    declare @id AS VARCHAR(6)

    -- this chose the prev last rec >> set @id = (select id from r7..t3 where id = (select max(id) from r7..t3) )

    set @id = (select id from t3 where id=(select max(id) -1 from t3) )

    --set @id = (Select top 1 id from r7..t3 order by ID desc)

    declare @FileName VARCHAR(8000)

    DECLARE @SQLCmd VARCHAR(500)

    declare @time VARCHAR(50)

    declare @date VARCHAR(50)

    set @time = replace(convert(varchar, getdate(), 108) ,':',';')

    set @date= (convert(varchar,getdate(),105))

    set @FileName = 'C:\Temp\'+@date+'_'+@time+'.xml'

    set @SQLCmd = 'bcp ' +

    '"SELECT c1 AS column1 ,c2 AS column2 FROM table as patientinfo WHERE id=' + @id +

    ' FOR XML auto,elements, ROOT(''xml'') "' +

    ' queryout ' +

    @FileName +

    ' -w -T -S computername\sqlinstance'

    SELECT @SQLCmd AS 'Command to execute'

    EXECUTE master..xp_cmdshell @SQLCmd

    END

    ---------------------------------------------------------------------------------------------------

    ok my idea is that im makin a trigger that export xml file for the last inserted recod , for example i inserted a record , immediatly i want the xml containg the records feild in a specific folder on a the server i could make the xml file but i couldnt find a way to tell the trigger the inserted record bcuzi guess the trigger locks it , until i go insert another record , i could export any record in the table but not the last inserted , i hope my idea is clear

    i didnt tried anything else ssis or CLR cuz im tryin to do it , i tried to stay away from coding (CLR) cuz im not that good but let me know wat do u think guys ?

    appreciated 🙂