Hello, I'm trying to create and populate some SQL Tables from log file using LogParser COM API.
I use SQL Output format with -createTable option enabled and i need an auto-generated identity column (an auto-increment primary key!)
I tried
SELECT 1, SendTime, Facility, Severity, MessageText ;
INTO [" + IPAdd.ToString() + "] "
FROM '" logfile + "' ";
WHERE SourceAddress LIKE ' " + IPAdd.ToString() + " '"
but I obtained
Error executing query: Error creating table
SQL State: 42000
Native Error: 102
Error Message: [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near 1.
Most
likely you're attempting to create a table with invalid column names,
such as names containing the '-' character, or names that are illegal
for the database you are connecting to (e.g. 'timestamp'). Rename the
columns in the SELECT clause using the AS statement. [Unknown Error]
OK! so I change my query in
SELECT 1 AS LogID, SendTime, Facility, Severity, MessageText ;
INTO [" + IPAdd.ToString() + "] "
FROM '" logfile + "' ";
WHERE SourceAddress LIKE ' " + IPAdd.ToString() + " '"
but I always obtain 1 in the first column, when i needed an identity column!
As you can see in my other post, i tried to create tables at run-time with SQLCommands embedded in my C# code, but it generates another error!
Please help me!
Thanks in advance,
Giancarlo Laurenzi.