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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using UPDATE in SQL

Status
Not open for further replies.

bellmd

Programmer
Sep 28, 2000
15
0
0
GB
There is a problem with this SQL statement. The problem is with the set command, with only one value to change it will work fine, but with more than one it returns an error.

Code:
UPDATE blank_date
SET name='Matthew' and telephone='678' and e-mail='matthew@sexycooking.co.uk'
WHERE (date = #3-Jan-2001#) or (date = #4-Jan-2001#) or (date = #5-Jan-2001#)

Please, please somebody help
 
UPDATE blank_date
SET name='Matthew' and telephone='678' and e-mail='matthew@sexycooking.co.uk'

should be:

UPDATE blank_date
SET
(name='Matthew', telephone='678', e-mail='matthew@sexycooking.co.uk')

good luck! :)
Paul Prewett
penny.gif
penny.gif
 
I've tried that but it still won't work.
 
What's the error message along with the complete SQL statement that's throwing it?
penny.gif
penny.gif
 
The SQL statement at the top of the list gives the error message;

Code:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
 
Well, you should definitely be using commas instead of 'and' to put the different values together, and the parens I suggested couldn't hurt, either.

Does it give the same message if you use what I suggested, or does the error message change?

You might also try enclosing the e-mail column name in brackets

[e-mail] <-- it might be trying to evaluate that as an arithmetic operator. FYI -- you might want to change the name of that field to email rather than 'e-mail' to eliminate the confusion.

lemme know -
paul
penny.gif
penny.gif
 
Having now tried all possible combinations of the above, I have got it to work using the statement below;

Code:
update blank_date 
set name='Matthew', telephone='678', email='matthew@sexycooking.co.uk' 
where (date = #7-Jan-2001#) or (date = #8-Jan-2001#)

Changing e-mail to email was a good tip, I think if it had not been for that it would have been an easily solved problem, because I tried the above statement but with e-mail rather than email and it gave an error. Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top