Solved

Convert INSERT to UPDATE

Posted on 2006-11-28
7
300 Views
Last Modified: 2009-12-16
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!
0
Comment
Question by:bsowards
  • 3
  • 3
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18030884
"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 = ?;"
0
 

Author Comment

by:bsowards
ID: 18030888
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
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18030903
you have to put it at the end, in the order they appear in the sql statement.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:bsowards
ID: 18030936
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'into'.
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 18031021
sorry, forgot to remove the keyword INTO:

"UPDATE 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 = ?;"
0
 
LVL 9

Expert Comment

by:danataylor
ID: 18031023
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.
0
 

Author Comment

by:bsowards
ID: 18031033
thanx, worked like a charm
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now