Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Updating records

Author  Topic 

Topaz
Posting Yak Master

199 Posts

Posted - 2007-11-16 : 05:34:40
Ive posted on here many times before and got the answers, so hopefully this time will be like the rest...you guys are SO good at SQL.

I have a database that has lots of fields. I use some specialised email marketing software that allows me contact each record. What I have done in the past is export the contacts i wanted to email and then format the columns like this: (all done in excel)

EmailAddress Website Salutation Website1 Website2 Website 3
info@eg.co.uk www.eg.co.uk David eg.co.uk Eg.Co.Uk Eg
test@red.co.uk www.red.co.uk Sue red.co.uk Red.Co.Uk Sue

After each list looks like this, i then import this data into Access and from there our email software pics up the data and emails accordingly.

Now here comes the problem...

We have decided that we now want everything done within our sql database. Which means we want clickthroughs recording and open rates etc all appearing in our database. (we have all this sorted out)

However we dont have Website1, 2 or 3 fields in our database. We know that they need to be included in our db somewhere but with half a million contacts we don't want to do it one by one obviously.

We want a simple where we export all our contacts and then format them so they include website1, 2 and 3. THEN we want to import them, simply updating the contacts with that new data. (Or is there a SQL way of creating temp tables so these fields dont even need to be included in the db?)

I hope i managed to explain myself in way you can all understand.

Thanks

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2007-11-16 : 06:03:53
Hi

what i told you here ... http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=92722

about updating with a join to a seperate table is, i think, what you're after.

What you'd need to do is... when you import your data back in to the db, make it a second table. then update your original with the new data (joined as per the example in your other thread), then just drop your imported table

Em
Go to Top of Page

georgev
Posting Yak Master

122 Posts

Posted - 2007-11-16 : 08:13:29
Instead of creating a second table which violates 3NF, why not create a VIEW?
You can think of a VIEW as a virtual table, so if you can write some SQL to produce the results you want, you needn't go about importing and exporting, just create your view from the statement and select from there in future!

Genius, no? :p


George
<3Engaged!
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2007-11-16 : 08:28:44
except that the OP says they don't have the additional info in the DB, so they will have to import it from somewhere, no?

Em
Go to Top of Page
   

- Advertisement -