Has anyone written code to insert a value into the mail_purpose field in T_EADDRESS without overwriting the existing values in that field? This field has 10 positions and I want to insert a value into one of the positions without erasing what's there. So the SET command won't work. I'm thinking there is a way to identify the position of the value you want to enter.
Hi Gloria,
Here is a simple function that adds and removes a single single purpose. It takes the current purposes string, the purpose to add or remove, and a mode parameter to tell it whether to add or remove. It returns the updated purposes string.
Jon
I think you're my hero Jon!
So I would need to include this function in a procedure, right (excuse my ignorance with functions)? What is the mode parameter - 1=add, 2=remove?
Then I can run this for a list?
I found that this works:
UPDATE t_eaddressSET Mail_Purposes=Mail_Purposes+'3'WHERE customer_no = 26824 AND CHARINDEX('3',Mail_Purposes)=0
But it doesn't put the purposes in the right order.
Do the values have to be in the right order?