Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql statement not working

Status
Not open for further replies.

hifive

Programmer
Jan 18, 2001
8
CA
It seems that there is an error in my sql statement, here is the message that ot gave....can someone find the problem...
_______________________________________________

This is the result++

UPDATE nouvelle SET date='fdsdf',title='sdfsd',contents='sdfsdf' WHERE nbnews='57'

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.


______________________

thank's

/admin/donenews57.asp, line 33
 
May be a datatype error, try losing the single quotes on non-strings, etc.

That's my only suggestion, the rest looks liek it should work.
 
How about:

UPDATE nouvelle (date,title,contents) SET ('fdsdf','sdfsd','sdfsdf') WHERE nbnews='57';

I agree completely with the single quote idea.
 
Sorry - I said I agree with the single quote idea and I put the quotes there anyway. If nbnews is a number field then I would say:
UPDATE nouvelle (date,title,contents) SET ('fdsdf','sdfsd','sdfsdf') WHERE nbnews=57;
 
MTL, the problem is you named a field date, which is probably a reserved word. Try:

UPDATE nouvelle T1 SET T1.[date]='fdsdf', T1.title='sdfsd', T1.contents='sdfsdf' WHERE T1.nbnews='57'

AFA the quotes, if the field types are text, they are necessary.

UPDATE nouvelle (date,title,contents) SET ('fdsdf','sdfsd','sdfsdf')

I imagine this would be the result if an UPDATE & INSERT query had an offspring. LOL

It has the structure of an Insert query:
INSERT TableName (field1,field2) VALUES(value1,value2)
but the commands of an Update query:
UPDATE TableName SET field1=value1, field2=value2 Jon Hawkins
 
Well ok. I screwed that up; i don't know what I was thinking. I actually know SQL but it certainly isn't evident from my two posts here. Laugh away.
 
Syntax errors aside, aren't you supposed to delimit date fields with # when using Access databases?

ie. ..."Datefield = #" & mydatefield & "#"
 
Well that's a good question. My example, such as it was, was supposed to be for Oracle; and it doesn't use the "#" escape character for dates (that I have ever seen). Formatting dates for Oracle is tricky and usually requires some TOCHAR() finagling to get it in a format that Oracle will accept.
 
I've been going against SQL Server for so long, I'm not sure about Access anymore, but it used to be that way. As for Oracle, I do remember it being tricky with all that TOCHAR or TODATE stuff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top