Need help with SYNTAX Error

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

I'm getting a SYNTAX error in this statement:

INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES (
'<[email protected]>',
'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc
(08/37)',
'4/11/2007',
'(e-mail address removed) (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!
 
Terry Olsen said:
I'm getting a SYNTAX error in this statement:

INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES (
'<[email protected]>',
'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc
(08/37)',
'4/11/2007',
'(e-mail address removed) (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
 
I'm getting a SYNTAX error in this statement:

INSERT INTO Usenet (MessageID,Subject,ArticleDate,From,Lines) VALUES (
'<[email protected]>',
'TG FM - The Eternal Candle - "eternalcandle_v.1.1.zip" 22716KB yEnc
(08/37)',
'4/11/2007',
'(e-mail address removed) (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
 
Back
Top