Search code examples
databaseloggingproc

Import IISLog Data Into table Sqlserver


Hi all friends have a double question First, how to write a procedure that can store an IIslog in a table in the database Second, how do we define the procedure as a job that can be set at intervals? Thanks so much for your guidance


Solution

  • Of course I did it myself: CREATE PROC SP_IISLog ( @TABLENAME VARCHAR(50), @PATHNAME VARCHAR(50) ) AS BEGIN DECLARE @SSQL NVARCHAR(50); SET @SSQL= ' BULK INSERT ' + @TABLENAME + ' FROM ''' + @PATHNAME + ''' WITH ( FIELDTERMINATOR = '','', ROWTERMINATOR = ''\n'' ) GO'
    exec sp_ExeCuteSQL @SSQL END