May this helps
CREATE TABLE MainTable(Col1 INT, Col2 VARCHAR(30),Col3 VARCHAR(30),FName VARCHAR(30) NULL,FPath VARCHAR(20) NULL)
GO
CREATE PROCEDURE ReadFile
@FileName VARCHAR(20),
@FilePath VARCHAR(20)
AS
BEGIN
CREATE TABLE #temp(Col1 INT, Col2 VARCHAR(30),Col3 VARCHAR(30))
DECLARE @String VARCHAR(MAX)
SET @String = ''
SET @String = 'BULK INSERT #temp FROM ''' + @FilePath + '''
WITH
(
FIELDTERMINATOR = '','',
ROWTERMINATOR = ''\n''
)'
EXEC (@String)
INSERT MainTable(Col1,Col2,Col3) SELECT * FROM #temp
UPDATE MainTable SET FName = @FileName
UPDATE MainTable SET FPath = @FilePath
DROP TABLE #temp
END
GO
EXEC ReadFile @FileName = 'Your File Name',@FilePath = 'File Path'
SELECT * FROM MainTable
GO