Import IIS Logs in SQL Server 2008

I am trying to import IIS logs into SQL Server 2008. I am getting this error below.

Error 0xc02020a1: data stream Task 1: Data conversion failed. The data conversion for the "cs (User-Agent)" column is the return value of status 4 and the status is text "Text was truncated or one or more characters were not in the target code." (SQL Server Import and Export Wizard)

I tried changing the column width of the user agent to varchar (8000) and nvarchar (4000) no luck. Help in search engines

-Vivek

+3
source share
3 answers

Not sure if this is the right way.

but it solved my problem

. 5000,

+2

?

Microsoft LogParser ( ), SQL- SQL Server, . - - ( {...} ):

LOGPARSER "SELECT * INTO {outtable} FROM {all090623.log}" 
        -o:SQL -server:{myserver}
        -database:{weblogs}
        -driver:"SQL Server" 
        -createTable

, , , ...

+9

, . , , > 8000 , .

Sometimes a line in the IIS file is not written correctly, and you get missing columns or overlapping columns, and this can cause a problem. But using "text" will certainly eliminate the problem of data truncation.

After importing, you can always set up a new column named [cs (User-Agent) varchar], which is varchar (8000), and copy the data into it using convert (varchar (8000), [cs (User-Agent)])

0
source

Source: https://habr.com/ru/post/1740020/


All Articles