Hi, I'm not sure if this has been discussed before, at least I couldn't find anything. I have a question regarding field types in case of CSV input files. Is it possible somehow change the type of the field? I have some fields which consists only from digits,
so LogParser interprets them as integers. The problem is that these fields are supposed to be text strings. In some cases they have leading zeros and those are droped by LogParser. Is there a way to tell LogParser that particular field is string?
Well, it's not doing what I want. If I have, for example, string 04092012, both "SELECT start FROM file" and "SELECT to_string(start) FROM file" return me 4092012. I.e., leading zero is removed in both cases.
partizan
2 Posts
set field's type for CSV file
Sep 03, 2012 11:37 AM|LINK
Hi, I'm not sure if this has been discussed before, at least I couldn't find anything. I have a question regarding field types in case of CSV input files. Is it possible somehow change the type of the field? I have some fields which consists only from digits, so LogParser interprets them as integers. The problem is that these fields are supposed to be text strings. In some cases they have leading zeros and those are droped by LogParser. Is there a way to tell LogParser that particular field is string?
peterviola
549 Posts
Re: set field's type for CSV file
Sep 04, 2012 04:13 PM|LINK
Hi,
Take a look at TO_STRING:
TO_STRING( argument <INTEGER | REAL> ) | ( timestamp <TIMESTAMP>, format <STRING> )
Converts a value of the REAL or INTEGER data type into a value of the STRING data type.
http://logparserplus.com/Functions
MCTIP SA, EST, DBA 2008
Please 'Mark as Answer' if this post helps you.
OrcsWeb: Managed Windows Hosting Solutions
"Remarkable Service. Remarkable Support."
partizan
2 Posts
Re: set field's type for CSV file
Sep 06, 2012 12:09 PM|LINK
Well, it's not doing what I want. If I have, for example, string 04092012, both "SELECT start FROM file" and "SELECT to_string(start) FROM file" return me 4092012. I.e., leading zero is removed in both cases.
ron_bo
52 Posts
Re: set field's type for CSV file
Nov 06, 2012 10:38 PM|LINK