trigger for copying into text file

  • i have ms sql 2008r2 express edition. i need a trigger that will copy newly added record into my table into text file. i tryed with xp_cmdshell but when my user is inserting new data in to table i receive error

    The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.

    i cannot create ##xp_cmdshell_proxy_account##. the accounts that i use are the administrators but i have not permissions.

    how create ##xp_cmdshell_proxy_account##?

    my trigger is

    USE [revizija1]

    GO

    /****** Object: Trigger [dbo].[powershell_script] Script Date: 09/14/2015 12:13:48 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    -- =============================================

    -- Author:<Author,,Name>

    -- Create date: <Create Date,,>

    -- Description:<Description,,>

    -- =============================================

    ALTER TRIGGER [dbo].[powershell_script]

    ON [dbo].[ClanTima_shadow]

    FOR INSERT

    AS

    BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Insert statements for trigger here

    EXEC xp_cmdshell 'powershell -Command ''C:\Users\administrator.DRI\Documents\sql.ps1'''

    END

    my powershell script will filter data in table and export last record to file.

    thank's

Viewing 0 posts

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