I have a phone number field that is varchar(50) that includes extensions. The extensions are designated by an 'x' as in 703 987-9878 x5543. The extension length varies. I can pull the extension part out into another column using:
select right(wphone,len(wphone)-charindex('x',wphone)) from mytable where wphone like '%x%'
My question is how do I remove the extension part from the original field? Or pull the other side of the wphone field into a new column? I've tried a couple different ways, but can't get it quite right.
Thanks
-D
select right(wphone,len(wphone)-charindex('x',wphone)) from mytable where wphone like '%x%'
My question is how do I remove the extension part from the original field? Or pull the other side of the wphone field into a new column? I've tried a couple different ways, but can't get it quite right.
Thanks
-D