I'm using logparser to read information from IIS into SQL.
& "C:\Program Files (x86)\Log Parser 2.2\LogParser.exe" "select EXTRACT_PREFIX(cs-uri-stem,2,'/') as Site, cs-username as Anvandarnamn, date as Datum INTO Raw_Statestik from C:\Statestik\Test\*.log where cs-username like '%%Domain%%' and cs-uri-stem like '/sites/%%' group by EXTRACT_PREFIX(cs-uri-stem,2,'/'), Anvandarnamn, Datum ORDER BY Site, Anvandarnamn ,Datum DESC" -recurse:1 -i:IISW3C -o:sql -server:Test\SQL2 -database:Anvandarstatestik -cleartable:OFF -transactionRowCount:-1
When I do this, I get the following error:
Task aborted. LogParser.exe : SQL table column "Datum" data type is not compatible with SELECT clause item At line:5 char:1
- & "C:\Program Files (x86)\Log Parser 2.2\LogParser.exe" "select EXTRA ...
-
+ CategoryInfo : NotSpecified: (SQL table colum...ECT clause item:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError "Datum" (type TIMESTAMP)
Statistics:
Elements processed: 0 Elements output: 0 Execution time: 3.02 seconds
The table in SQL:
CREATE TABLE [dbo].[Raw_statestik](
[Site] [nvarchar](100) NOT NULL,
[Anvandarnamn] [nvarchar](50) NOT NULL,
[Datum] [date] NOT NULL
) ON [PRIMARY]
I tested to create the Datum (date) as varchar, nvarchar as well.
If I would do output to CSV I will get the date and can read in the file manually to SQL. If I do raw output in powershell I see the date.
So this confuses me a bit, how can it want timestamp when it's only date? What am I missing? I remember I did this 5 years ago and had no problems at all.