What’s the best way to read a text file using T-SQL? I’ve seen the BULK INSERT and many different functions but non of them are what I’m looking for.
I need to read each line in the text file and then insert it into a table with some other information like filename, filelocation, status, record date & time created, etc.
The BULK INSERT does not allow me to add extra field unless I’m missing something on this.
Any help or pointing the right direction will be really appreciate it.
You could probably do bulk insert into a temp table and then do another insert joining with the data you want to add. Here is an example
Does this not do what you’d like?