Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating Boolean based off character and character location

Status
Not open for further replies.

onyxtacular

IS-IT--Management
Mar 31, 2006
19
US
Our company for years have used a text field as a way of adding more information about the customer. There are 3 digits in the code and the depending on the character and the position lets us know some information about the customer. Recently I found a way to add custom fields.
Now I would like to write a query to update those fields based on the 3 digit code..... If the first digit of the code is a space, the customer is inactive:

I have to read from the CUSTOMER_MASTER.CUSTYP_23 and based off the location and character update the Boolean in CUSTOMER_MASTER_EXT.INACTCUS

I was able to hack together this join statement that listed both tables together
SELECT cUSTOMER_MASTER.CUSTID_23, CUSTYP_23, inactcus, [2020], autograph, cabvis, planit
from Customer_Master
inner join Customer_Master_ext
on CUSTOMER_MASTER.CUSTID_23 = CUSTOMER_MASTER_EXT.CUSTID_23

 
I figured it out...


UPDATE customer_master_ext
SET [2020] = 1
FROM customer_master
inner join Customer_Master_ext
on CUSTOMER_MASTER.CUSTID_23 = CUSTOMER_MASTER_EXT.CUSTID_23
WHERE
substring(customer_master.custyp_23,2,1)='2'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top