Skip to content

Instantly share code, notes, and snippets.

@ShubhamS32
Last active February 3, 2019 09:45
Show Gist options
  • Select an option

  • Save ShubhamS32/76392bfb131b5d28cf390682a3ae092c to your computer and use it in GitHub Desktop.

Select an option

Save ShubhamS32/76392bfb131b5d28cf390682a3ae092c to your computer and use it in GitHub Desktop.
Some of the shortcuts,techniques learned in Abbott
1)To Use Replace
select replace(coName,'Char to Repalce','Char to Replace with')
2)Relace the leading zeros of text
SELECT REPLACE(LTRIM(REPLACE('094434580980','0',' ')),' ','0') FROM table1
3)Replace Trailing zeros of the text
SELECT REPLACE(RTRIM(REPLACE('094434580980','0',' ')),' ','0') FROM table1
4)Removing blank spaces in between
SELECT REPLACE(stockist_tel_no, ' ', ''),stockist_tel_no,len(stockist_tel_no)
from cpmst_stockist_gen
where
len(stockist_tel_no)>10
5)Remove paranthesis
SELECT Replace(Replace(stockist_tel_no,')',''),'(',''),stockist_tel_no
from cpmst_stockist_gen
where
(stockist_tel_no like '%)%' or stockist_tel_no like '%(%')
update cpmst_stockist_gen
set stockist_tel_no = Replace(Replace(stockist_tel_no,')',''),'(','')
from cpmst_stockist_gen
where
(stockist_tel_no like '%)%' or stockist_tel_no like '%(%')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment