I'm getting a SYNTAX error in this statement: INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES ( '<131prkkuk51ed5@news.supernews.com>', 'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc (08/37)', '4/11/2007', 'None@none.a (Sxerks)', 5082) I believe it might have something to do with the double-quotes in the subject or the LessThan & GreaterThan in the MessageID, but I'm not sure. Can someone point out where I'm going wrong in this statement? Thanks!
[quoted text, click to view] "Terry Olsen" <tolsen64@hotmail.com> wrote in message news:%234TyE9EwHHA.4480@TK2MSFTNGP02.phx.gbl... > I'm getting a SYNTAX error in this statement: > > INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES ( > '<131prkkuk51ed5@news.supernews.com>', > 'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc > (08/37)', > '4/11/2007', > 'None@none.a (Sxerks)', > 5082) > > I believe it might have something to do with the double-quotes in the > subject or the LessThan & GreaterThan in the MessageID, but I'm not sure. > Can someone point out where I'm going wrong in this statement? > > Thanks!
What database engine? SQL Server 2005, SQL Server 2000, Oracle, etc.? What are the data types of the fields in the table? And, exactly what is the error message you are getting?
Terry, "From" is a reserved word in Access. You will need to change the name of the column. Kerry Moorman [quoted text, click to view] "Terry Olsen" wrote: > MDB file, using OLEDB. The error is "SYNTAX error in statement" > > "PvdG42" <pvdg@toadstool.edu> wrote in message > news:efPq8ZFwHHA.4480@TK2MSFTNGP02.phx.gbl... > > > > "Terry Olsen" <tolsen64@hotmail.com> wrote in message > > news:%234TyE9EwHHA.4480@TK2MSFTNGP02.phx.gbl... > >> I'm getting a SYNTAX error in this statement: > >> > >> INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES ( > >> '<131prkkuk51ed5@news.supernews.com>', > >> 'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc > >> (08/37)', > >> '4/11/2007', > >> 'None@none.a (Sxerks)', > >> 5082) > >> > >> I believe it might have something to do with the double-quotes in the > >> subject or the LessThan & GreaterThan in the MessageID, but I'm not sure. > >> Can someone point out where I'm going wrong in this statement? > >> > >> Thanks! > > What database engine? SQL Server 2005, SQL Server 2000, Oracle, etc.? > > What are the data types of the fields in the table? > > And, exactly what is the error message you are getting? > > > >
MDB file, using OLEDB. The error is "SYNTAX error in statement" [quoted text, click to view] "PvdG42" <pvdg@toadstool.edu> wrote in message news:efPq8ZFwHHA.4480@TK2MSFTNGP02.phx.gbl... > > "Terry Olsen" <tolsen64@hotmail.com> wrote in message > news:%234TyE9EwHHA.4480@TK2MSFTNGP02.phx.gbl... >> I'm getting a SYNTAX error in this statement: >> >> INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES ( >> '<131prkkuk51ed5@news.supernews.com>', >> 'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc >> (08/37)', >> '4/11/2007', >> 'None@none.a (Sxerks)', >> 5082) >> >> I believe it might have something to do with the double-quotes in the >> subject or the LessThan & GreaterThan in the MessageID, but I'm not sure. >> Can someone point out where I'm going wrong in this statement? >> >> Thanks! > What database engine? SQL Server 2005, SQL Server 2000, Oracle, etc.? > What are the data types of the fields in the table? > And, exactly what is the error message you are getting? >
On Fri, 6 Jul 2007 22:28:28 -0600, "Terry Olsen" [quoted text, click to view] <tolsen64@hotmail.com> wrote: >I'm getting a SYNTAX error in this statement: > >INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES ( >'<131prkkuk51ed5@news.supernews.com>', >'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc >(08/37)', >'4/11/2007', >'None@none.a (Sxerks)', >5082) > >I believe it might have something to do with the double-quotes in the >subject or the LessThan & GreaterThan in the MessageID, but I'm not sure. >Can someone point out where I'm going wrong in this statement? > >Thanks! >
1) What is the syntax error? 2) User parameterized queries ... they'll shield you from all the associated problems of escaping strings, formatting of date values, etc --
Terry, As Kerry said, "From" is a reserved word, and cannot be used in this context. However, you do not need to rename the column in the table - just wrap the column name in square brackets in your insert statement: [From] hope this helps [quoted text, click to view] "Terry Olsen" wrote: > I'm getting a SYNTAX error in this statement: > > INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES ( > '<131prkkuk51ed5@news.supernews.com>', > 'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc > (08/37)', > '4/11/2007', > 'None@none.a (Sxerks)', > 5082) > > I believe it might have something to do with the double-quotes in the > subject or the LessThan & GreaterThan in the MessageID, but I'm not sure. > Can someone point out where I'm going wrong in this statement? > > Thanks! > >
Don't see what you're looking for? Try a search.
|