On Tue, 2010-07-13 at 15:00 +0400, Khaleelah Peerbocus wrote:
Hi
When I do a cat on the pipe just to see wats the output I get the following
INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:22', 'syslogng', 'agetty', '1316', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:32', 'syslogng', 'init', '', 'Id \"x0\" respawning too fast: disabled for 5 minutes'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:45:32', 'syslogng', 'init', '', 'Id \"x0\" respawning too fast: disabled for 5 minutes'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:50:33', 'syslogng', 'agetty', '1318', '/dev/xvc0: No such file or directory'); INSERT INTO logs (datetime,host,program,pid,message) VALUES ( 'Jul 13 14:50:33', 'syslogng', 'agetty', '1318', '/dev/xvc0: No such file or directory'); INSERT INTO logs
And when the script is ran
I get the following errors
[ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'logs'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'datetime'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near the keyword 'VALUES'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'logs'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'datetime'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepareing SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near the keyword 'VALUES'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared. [ISQL]ERROR: Could not SQLPrepare SQL> [37000][unixODBC][FreeTDS][SQL Server]Incorrect syntax near 'logs'. [37000][unixODBC][FreeTDS][SQL Server]Statement(s) could not be prepared.
So I guessed because it is processing each line independently.
Any idea?
don't you happen to have newline character in the template() option that you specified. I thought it was only because the mailer wrapped your lines, but seeing the actual output seems to indicate that you _do_ have embedded newline characters in the template itself. -- Bazsi