create table #tblRegistration
(
Phone1 varchar (10)
)
insert into #tblregistration
select '9334457582' union
select '1234567890'
select
replace(Phone1,SUBSTRING(phone1,3,6),'******') ---This one
from #tblregistration
drop table #tblRegistration
This should stop the error message. Just include the marked line in your select list. Let me know how you get on please.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537