Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import IIS log into SQL Server 2008 error

I'm trying to import IIS logs into SQL Server 2008. I get this error below.

Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "cs(User-Agent)" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard)

I tried changing the column width of user agent to varchar(8000) and nvarchar(4000) no luck. pls help

-Vivek

like image 724
Vivek Chandraprakash Avatar asked Apr 18 '26 08:04

Vivek Chandraprakash


1 Answers

How are you performing the import?

I'd also look at Microsoft's LogParser (as Mayo mentioned in a comment), as well as querying the files in a SQL-like manner, you can also use it to import the files into a SQL Server database, and it will take care of creating the target tables for you. Syntax is something like (replacing the {...} placeholders as appropriate):

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

Once it's in the database you can add indexes as usual, and away you go...

like image 139
Chris J Avatar answered Apr 20 '26 09:04

Chris J



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!