BCP utility

  • Hi,

    DECLARE @FILE VARCHAR(50)

    DECALRE @x VARCHAR(8000)

    SET @FILE='C:\ABC_'+(SELECT CONVERT(VARCHAR(20),GETDATE(),12))

    SET @x ='bcp "select * from employee" queryout C:\ABC_101209.TXT ' -T -w

    EXEC MASTER..xp_cmdshell @x

    I would like to define the outputfile dynamically (C:\ABC_101209)

    after the file name which should be in the form of YYMMDD .

    Every time I execute the file has to be with the extension of yymmdd format.

  • This was removed by the editor as SPAM

  • Hi,

    It's not working.Is there a way to rename the file.

    Thanks,

    Nagesh

  • This was removed by the editor as SPAM

  • Hi Stewart,

    It's working now.Even the first statement also working.

    Thansk a bunch.

Viewing 5 posts - 1 through 4 (of 4 total)

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