SQL Code to Change Multiple Customer Groups

Ok, thanks for the tips, I'll look into this.
Hi,

I was wondering if someone knew some sql code that would allow me to
change a customer field for many customers at once. We have a ton of
customers in a "Miscellaneous" customer group. I would like to put
some of them in another group. Is there code that would reflect
something like this idea (this is a guess, I don't code sql):


UPDATE Customer
SET groupcode='NEWGROUP'
WHERE (CustID='CustA,' `CustB,' `CustC,' `CustD,' `CustE')

I just want to change the groupcode of many customers at once rather
than having to do them individually. If anyone could help me out, that
would be great. Thanks!
You have to change it to



UPDATE PUB.Customer SET groupcode='NEWGROUP' WHERE
(Customer.CustID='CustA' OR Customer.CustID='CustB' OR
Customer.CustID='CustC' OR Customer.CustID='CustD' OR
Customer.CustID='CustE') And Customer.Company='MT';

commit;





Adam Gwizdz
Manager, Corporate IT Systems
1 Capital Drive, Suite 101
Cranbury, NJ 08512

_____

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of pbriscoe10
Sent: Friday, February 20, 2009 12:46 PM
To: vantage@yahoogroups.com
Subject: [Vantage] SQL Code to Change Multiple Customer Groups



Hi,

I was wondering if someone knew some sql code that would allow me to
change a customer field for many customers at once. We have a ton of
customers in a "Miscellaneous" customer group. I would like to put
some of them in another group. Is there code that would reflect
something like this idea (this is a guess, I don't code sql):

UPDATE Customer
SET groupcode='NEWGROUP'
WHERE (CustID='CustA,' `CustB,' `CustC,' `CustD,' `CustE')

I just want to change the groupcode of many customers at once rather
than having to do them individually. If anyone could help me out, that
would be great. Thanks!





[Non-text portions of this message have been removed]
Great, that seems to have worked. Thank you :).

I guess a general follow-up inquiry would be, is there a simple way to
generate sql code for multiple OR statements. What I mean is, is there
a way that I don't have to type each and every CustID code for the
customers I want to use in this code? Can I somehow copy them from a
spreadsheet and put them into the code quickly? This isn't necessary,
just convenient. Although I don't deal with much code, I'm sure this
type of automation must come up at times. Thanks again!
--- In vantage@yahoogroups.com, "pbriscoe10" <pbriscoe10@...> wrote:
>
> Great, that seems to have worked. Thank you :).
>
> I guess a general follow-up inquiry would be, is there a simple way
to
> generate sql code for multiple OR statements. What I mean is, is
there
> a way that I don't have to type each and every CustID code for the
> customers I want to use in this code? Can I somehow copy them from a
> spreadsheet and put them into the code quickly? This isn't necessary,
> just convenient. Although I don't deal with much code, I'm sure this
> type of automation must come up at times. Thanks again!
>

I used VB.net for something like this. I queried the database for the
CustID code (using your example) then had vb.net create lines of sql
code witht hose CustIDs. I believe you could also do procedures in
progress in java, but I'm more familiar with vb.net.