why can''t i bulk insert from filename that is a variable???

  • i want to bulk insert from a file that the name changes according to the date

    set @filename = 'D:\websites\neolane\www\Import\mvt_' + convert(varchar(10),getdate(),112) + '.txt'

    BULK INSERT #textfile FROM @filename

    why wouldnt it accept it???

  • set @filename = 'BULK INSERT #textfile FROM ''D:\websites\neolane\www\Import\mvt_' + convert(varchar(10),getdate(),112) + '.txt'''

    EXEC (@filename)

    _____________
    Code for TallyGenerator

  • ok great! tx a lot!

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

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