Link to home
Start Free TrialLog in
Avatar of irodov
irodov

asked on

a sybase sql help please

Hi experts,

would appreciate help with a sql

I need to write a sybase sql which does the following,

It should look for a value in the column and if it starts with V1XXXXX -- it should change to PNXXXXX
Can you kindly help me with this,

Thanks,
Avatar of grant300
grant300

I think you mean if it start with "V1" you want to change the prefix to "PN".

You're in luck; this is an easy one.

UPDATE YourTable
      SET YourColumn = STUFF(YourColumn,1,2,'PN')
 WHERE YourColumn LIKE 'V1%'

The % wild card matches any number of characters including 0.  If you want to specifically change just the rows with 5 characters after the V1, change it to.....

  LIKE 'V1_____'

using 5 underscores which are the single character wild card.

Regards,
Bill
Avatar of irodov

ASKER

is this a sybase function STUFF???

what does this do?

ASKER CERTIFIED SOLUTION
Avatar of grant300
grant300

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial