Link to home
Start Free TrialLog in
Avatar of bsowards
bsowards

asked on

Convert INSERT to UPDATE

Hi,

Could someone convert this to an UPDATE query please?

"INSERT into report (rp_title, rp_date, rp_desc, rp_category, rp_code, rp_link_page, rp_link_brochure, rp_link_subscribe, rp_year_start, rp_year_end, rp_n_america, rp_latin, rp_e_europe, rp_w_europe, rp_middle_east, rp_asia, rp_unpublished) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"

I'm using parameterized queries, and it will be WHERE rp_id = @rp_id

Thanks!
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

"UPDATE  into report set rp_title = ?, rp_date = ?, rp_desc= ?, rp_category= ?, rp_code= ?, rp_link_page= ?, rp_link_brochure= ?, rp_link_subscribe= ?, rp_year_start= ?, rp_year_end= ?, rp_n_america= ?, rp_latin= ?, rp_e_europe= ?, rp_w_europe= ?, rp_middle_east= ?, rp_asia= ?, rp_unpublished= ? where rp_id = ?;"
Avatar of bsowards
bsowards

ASKER

should I put the rp_id parameter at the end or beginning of the list that follows? or doesn't it matter. i know it does in access
you have to put it at the end, in the order they appear in the sql statement.
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'into'.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You don't need the "into" clause for an update statement, just "update report set..."  In fact, I'm not sure it will work with it in there.
thanx, worked like a charm