Solved

Convert INSERT to UPDATE

Posted on 2006-11-28
7
310 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Gridview does not exist in the current context 14 63
Help with stored procedure 30 59
Issue with Loop 4 49
Connection String to remote Server not working 3 72
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

19 Experts available now in Live!

Get 1:1 Help Now