Monday, March 19, 2012
A text file data source
I have to write a report that uses a .txt file as a data-source and I
am not sure how to do that.
Anyone know where I can find out how to set this up? ODBC Connection?
The .txt file format is like this...(top 5 rows)
20040881 2004/12/22 01:30:12 NONIMPACT
20040883 2004/12/22 15:02:12 NONIMPACT
20040884 2004/12/22 17:52:12 NONIMPACT
20040885 2004/12/23 11:20:12 NONIMPACT
20040891 2004/12/23 15:10:12 NONIMPACT
and so one....
Any help would be great!!!!!!!!!!!!
Thanks, KerrieI've never tried to reach a flat text file, but I do not think that SRS
supports connecting directly to a flat file...(correct me if I am
wrong).
You may have to write your own data processing extension that can
connect to the files you want and extract the data therein. Hope this
helps!
Lance M.
Kerrie wrote:
> Hi all,
> I have to write a report that uses a .txt file as a data-source and I
> am not sure how to do that.
> Anyone know where I can find out how to set this up? ODBC Connection?
> The .txt file format is like this...(top 5 rows)
> 20040881 2004/12/22 01:30:12 NONIMPACT
> 20040883 2004/12/22 15:02:12 NONIMPACT
> 20040884 2004/12/22 17:52:12 NONIMPACT
> 20040885 2004/12/23 11:20:12 NONIMPACT
> 20040891 2004/12/23 15:10:12 NONIMPACT
> and so one....
> Any help would be great!!!!!!!!!!!!
> Thanks, Kerrie|||Create a linked data source of type CSV to the flat file and use it in
your report against the text file.
Lance M wrote:
> I've never tried to reach a flat text file, but I do not think that SRS
> supports connecting directly to a flat file...(correct me if I am
> wrong).
> You may have to write your own data processing extension that can
> connect to the files you want and extract the data therein. Hope this
> helps!
> Lance M.
> Kerrie wrote:
> > Hi all,
> > I have to write a report that uses a .txt file as a data-source and I
> > am not sure how to do that.
> >
> > Anyone know where I can find out how to set this up? ODBC Connection?
> >
> > The .txt file format is like this...(top 5 rows)
> > 20040881 2004/12/22 01:30:12 NONIMPACT
> > 20040883 2004/12/22 15:02:12 NONIMPACT
> > 20040884 2004/12/22 17:52:12 NONIMPACT
> > 20040885 2004/12/23 11:20:12 NONIMPACT
> > 20040891 2004/12/23 15:10:12 NONIMPACT
> >
> > and so one....
> >
> > Any help would be great!!!!!!!!!!!!
> >
> > Thanks, Kerrie
Sunday, February 19, 2012
A problem with bcp tool
I use bcp tool. The problem is about a column named 'FILE', that I've
declared as:
[FILE] VARCHAR(150) NOT NULL
The command I launch is the following:
bcp.exe EC_CUNEO01.PROJECT.ANTRACCIATO in data_file.txt -f
format_file.fmt -e error_file.err -m 10 -t\t -r\n -k -b1000 -U user -P
password -S server
In the format_file I've declared the format of the columns, referring to the
'FILE' one as:
3 SQLCHAR 0 150 "\t" 3 [FILE]
But when I try to import the data, the system returns the error:
SQLState = 37000, NativeError = 156
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near
the keyword 'FILE'.
Does anybody know why?
Thank you."Federica T" <fedina_chicca@.N_O_Spam_libero.it> wrote in message
news:ckok38$1hs$1@.atlantis.cu.mi.it...
>I need to transfer some data from a file .txt to a SQL Server.
> I use bcp tool. The problem is about a column named 'FILE', that I've
> declared as:
> [FILE] VARCHAR(150) NOT NULL
> The command I launch is the following:
> bcp.exe EC_CUNEO01.PROJECT.ANTRACCIATO in data_file.txt -f
> format_file.fmt -e error_file.err -m 10 -t\t -r\n -k -b1000 -U user -P
> password -S server
> In the format_file I've declared the format of the columns, referring to
> the
> 'FILE' one as:
> 3 SQLCHAR 0 150 "\t" 3 [FILE]
> But when I try to import the data, the system returns the error:
> SQLState = 37000, NativeError = 156
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax
> near
> the keyword 'FILE'.
> Does anybody know why?
> Thank you.
I would guess it's because FILE is a reserved keyword in MSSQL. According to
BOL, the correct column name is not required in a format file anyway, so you
could try replacing it with a non-reserved word to see what happens.
Alternatively, try using DTS, which is often a bit 'smarter' about these
things, but you should probably change your column name to a non-reserved
word anyway. I appreciate that you might have no control over that, however.
Simon|||> I would guess it's because FILE is a reserved keyword in MSSQL. According
to
> BOL, the correct column name is not required in a format file anyway, so
you
> could try replacing it with a non-reserved word to see what happens.
> Alternatively, try using DTS, which is often a bit 'smarter' about these
> things, but you should probably change your column name to a non-reserved
> word anyway. I appreciate that you might have no control over that,
however.
> Simon
I would maintain the name of the column because my application already runs
on a DB2 preexisting Database, which contains columns with this name; I
would make less change as possible...
Thank you, I will try DTS!
Bye
Fede