Example:
create table test ([values] varchar(30))go
insert into test values ('000001234')insert into test values ('00000000123456')insert into test values ('000123467') insert into test values ('001234787')insert into test values ('00000001234787')insert into test values ('000012343435')go
SELECTsubstring([values],PATINDEX('%[^0]%',[values]),10) as [values_modified],'Zeroes is Removed' as Removed_Valuesfrom
test
create table test ([values] varchar(30))go
insert into test values ('000001234')insert into test values ('00000000123456')insert into test values ('000123467') insert into test values ('001234787')insert into test values ('00000001234787')insert into test values ('000012343435')go
SELECTsubstring([values],PATINDEX('%[^0]%',[values]),10) as [values_modified],'Zeroes is Removed' as Removed_Valuesfrom
test
No comments:
Post a Comment