473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Update bad addresses

I got got a pile of bad email addresses to update in our SQL database.
I know how to do this for individual records using the update command.
Is there a way to execute an update using the list of addresses in an
excel spreadsheet or some other form of list? This kind of scripting
is new territory for me.

Jan 27 '07 #1
5 1915
If your Excel file has a column matching the the Primary Key of the
database table, in addition to the email address column, you can use
DTS(2000) or SSIS(2005) to import it into a table and use an INNER JOIN
in you UPDATE.

On Jan 26, 4:23 pm, "Chris" <cjscu...@gmail.comwrote:
I got got a pile of bad email addresses to update in our SQL database.
I know how to do this for individual records using the update command.
Is there a way to execute an update using the list of addresses in an
excel spreadsheet or some other form of list? This kind of scripting
is new territory for me.
Jan 27 '07 #2
Your best bet is to import the addresses using DTS or SSIS and then doing an
update join.

--
Andrew J. Kelly SQL MVP

"Chris" <cj******@gmail.comwrote in message
news:11**********************@l53g2000cwa.googlegr oups.com...
>I got got a pile of bad email addresses to update in our SQL database.
I know how to do this for individual records using the update command.
Is there a way to execute an update using the list of addresses in an
excel spreadsheet or some other form of list? This kind of scripting
is new territory for me.

Jan 27 '07 #3
Unfortunately I just have the email addresses.

I know I can get the primary key for an individual record using a
select statement like the one below.
use maindb
go
select *
from dbo.tblLead
where email = 'b**@address.com'

Is there a way to use the excel list in the place of the single bad
address and then dump the results into a new table? Then do the
update as described below as a separate process? If I wanted to just
delete bad addresses where I don't have a new address and leave the
rest of the lead information alone could I do that using an Inner join
in my update? All references I have found to the delete statement
talk about deleting entire rows of data and I don't want to do that.

Chris

On Jan 26, 6:32 pm, "Steve" <morrisz...@hotmail.comwrote:
If your Excel file has a column matching the the Primary Key of the
database table, in addition to the email address column, you can use
DTS(2000) or SSIS(2005) to import it into a table and use an INNER JOIN
in you UPDATE.

On Jan 26, 4:23 pm, "Chris" <cjscu...@gmail.comwrote:
I got got a pile of bad email addresses to update in our SQL database.
I know how to do this for individual records using the update command.
Is there a way to execute an update using the list of addresses in an
excel spreadsheet or some other form of list? This kind of scripting
is new territory for me.
Jan 29 '07 #4
Unfortunately I only have a list of addresses. I know I can retrieve
the primary key associated with an individual address using the
following select statement or somehting similar.

use leaddb
go
select primary_key, email
from dbo.tblLead
where email = 'b*******@address.com'

Is it possible to use a variable in the where statement that picks up
the data in the excel file and then dumps the results into a table for
the purposes of doing the update as described below? Also if I don't
have a new address to update with how do I delete the email address
but leave the rest of the record in tact? All of the references I
have seen to the DELETE statement refer to deleting rows from the
table. I don't want to do that - only the email address.

On Jan 26, 6:32 pm, "Steve" <morrisz...@hotmail.comwrote:
If your Excel file has a column matching the the Primary Key of the
database table, in addition to the email address column, you can use
DTS(2000) or SSIS(2005) to import it into a table and use an INNER JOIN
in you UPDATE.

On Jan 26, 4:23 pm, "Chris" <cjscu...@gmail.comwrote:
I got got a pile of bad email addresses to update in our SQL database.
I know how to do this for individual records using the update command.
Is there a way to execute an update using the list of addresses in an
excel spreadsheet or some other form of list? This kind of scripting
is new territory for me.
Jan 29 '07 #5
Chris wrote:
Unfortunately I just have the email addresses.

I know I can get the primary key for an individual record using a
select statement like the one below.
use maindb
go
select *
from dbo.tblLead
where email = 'b**@address.com'

Is there a way to use the excel list in the place of the single bad
address and then dump the results into a new table? Then do the
update as described below as a separate process? If I wanted to just
delete bad addresses where I don't have a new address and leave the
rest of the lead information alone could I do that using an Inner join
in my update? All references I have found to the delete statement
talk about deleting entire rows of data and I don't want to do that.
Say you create a table (tblBadAddresses) with one column (email) and
dump the Excel data into it, then the next step is as follows:

update tblLead
set email = null
where email in (select email from tblBadAddresses)
Jan 30 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Westcoast Sheri | last post by:
To keep track of how many fruits my visitors buy, I use a mySQL database (2 columns: "fruit" and "quantity")....so can we make these following mySQL queries work somehow? (visitor buys 5...
7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
1
by: Frank Maestas | last post by:
Hello, I have two tables "contact_tbl" and "address_tbl". I have a query that compares the email addresses between the two. If a match is found I need to update a specific field in "contact_tbl"...
9
by: David Berman | last post by:
I'm having a problem with an update operation in a stored procedure. It runs so slowly that it is unusable, unless I comment a part out in which case it is very fast. However, I need the whole...
5
by: Janick Bernet | last post by:
The following Update fails with SQL0407N on Colum "Name", although the source-table t_Addresses_2005 is defined with NOT NULL on that column: UPDATE Addresses.t_Paddresses Old SET (Name,...
9
by: rhaazy | last post by:
Using MS SQL 2000 I have a stored procedure that processes an XML file generated from an Audit program. The XML looks somewhat like this: <ComputerScan> <scanheader>...
22
by: pbd22 | last post by:
hi. I am having probelms with an update statement. every time i run it, "every" row updates, not just the one(s) intended. so, here is what i have. i have tried this with both AND and OR and...
1
by: Arved Sandstrom | last post by:
This seems to be something so simple that none of the hundred-odd tutorials and forum threads that I have looked at (:-)) apparently thinks it's a problem. In a nutshell, I have two...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.