[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Insert record for user and update all duplicates

Posted on 2009-04-03
3
Medium Priority
?
259 Views
Last Modified: 2012-05-06
I want to insert a record for a user but update a field on all other record with that exact email address.
I am adding a column in the DB for duplicate.
SQL = "INSERT INTO homeFormUsers (firstName,lastName,emailAdd,interestedIn,datesubmitted)"
SQL = SQL & "VALUES ('" & strFname & "','" & strLname & "','" & strEmailAdd & "','" & strIntersted & "','" & strCurrDateTime & "') "

Open in new window

0
Comment
Question by:pGustafson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 24060464
need a trigger:

create trigger mytrigger on homeFormUsers
for insert
as
begin
update h
somefield = somevalue
from homeFormUsers  h
join inserted i on h.emailAdd = i.emailadd

end
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 24060468
>>but update a field on all other record with that exact email address

What field is that? you can try:

...

SQL = "Update homeFormUsers Set yourField =yourValue Where emailAdd = '" & strEmailAdd & "' "

conn.execute SQL

SQL = "INSERT INTO homeFormUsers (firstName,lastName,emailAdd,interestedIn,datesubmitted)"
SQL = SQL & "VALUES ('" & strFname & "','" & strLname & "','" & strEmailAdd & "','" & strIntersted & "','" & strCurrDateTime & "') "

conn.execute SQL

....


get the idea?
0
 

Author Closing Comment

by:pGustafson
ID: 31566260
That worked, thank you!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

656 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