Hi, I really cannot understand your requirement. What you are trying to achieve, is not at all clear in the statement presented here. I fully agree with Abhishek. However, if you invoke the statement "update tale1 set substring(orderno,6,2) = 'tt'" you will get the following error "Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ','." Now, I have a table say tblOrder with the following records.
OrderNo
123456789
234567891
345678912
45678123
67
78
89
My goal is to update those orderno's that will satisfy the condition substring(orderno,6,2). Means, if the order no is 987623456 , then substring('987623456',6,2) will yield me 34. So if any OrderNo 34 is present, that will be updated. The query is
update tblOrder set OrderNo = 'tt'
where OrderNo in( select substring(OrderNo,6,2) from tblOrder)
The output is
OrderNo
123456789
234567891
345678912
45678123
tt
tt
tt
Hope this helps :)
Niladri Biswas