btamulis 2/20/2024 7:25:56 AM

Yet another SQL Question

Okay - I'm trying to grab the first five letters of a customer name field in GP. In some cases, the Customer name starts with numbers which I need to strip out. 

Example - here the data:

 

I'm trying to use PATINDEX and LEFT to get the first five letters -

Here's my feeble attempt:

select LEFT( PATINDEX('%[A-Z]%', CUSTNAME), 5) as CustomerName from RM00101

This returns - 

Obviously, it's just counting where the first letter begins not returning anything. 

I originally tried substring - then settled on PATINDEX.

Any help would be greatly appreciated - thanks 

 

 

 

Version: All
Section: SQL Scripts


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3