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.
| Author |
Topic |
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-10-01 : 02:38:10
|
| My question is, each time I send an email, the email has a tracker image that has querystring values of username and emailid. This two values will be inserted into my "email_tracker" table. (Both username and emailid is unique - 1 username may have several emailid's)However now, I want to add a campaignid to my table each time an email is sent out.So for instance I sent out 2 emails now, I want this 2 emails to have a campaignid of value 1. And when I click my send button again, the campaignid will have value 2. Im still cracking my skull thinking of how to implement this and what columns to add in my table.So the data in my table may be something likeusername emailid campaignidjessie 1 1jessie 1 2And as per my previous thread, Ive decided NOT to have a counter column and I will just take the SUM of all the emails sent based on the campaignid, because I am going to append dates to each email that was read so I can display in my gridview a datetime column.One can never consent to creep,when one feels an impulse to soarRAMMOHAN |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-01 : 02:40:56
|
| you can make campaignid an int column and give campaignid value as SELECT COALESCE(MAX(campaignid),0)+1 FROM yourtable for each insert |
 |
|
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-10-01 : 02:58:24
|
| hi visakh16,but,campaignid has to be incremented once for username/emailid combination.that meansaction campaignid+1 MAX(campaignid),0)+1 campaignid(1) campaignid(2)sent User1/email1 1 1sent User2/email1 1 2sent User1/email2 1 3sent User1/email1 2 4sent User1/email2 2 5sent User1/email2 3 6Select * from email_tracker will beUsername EmailId campaignid(1) campaignid(2)User1 email1 2 4User1 email2 3 6User2 email1 1 2I'm don't want values of campaignid(2).only i need campaignid(1)One can never consent to creep,when one feels an impulse to soarRAMMOHAN |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-01 : 03:03:05
|
| do you do one by one or batch insert? |
 |
|
|
rammohan
Posting Yak Master
212 Posts |
Posted - 2009-10-01 : 03:04:45
|
| one by one only,for each button click from asp.net application i need to perform thisOne can never consent to creep,when one feels an impulse to soarRAMMOHAN |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-01 : 03:08:14
|
| so for each of records inserted you want same value of campaignid? what determines how long you want this value before it changes? |
 |
|
|
|
|
|
|
|