一个SQL批量执行语句大家帮帮忙。。
表user      字段tel   
 010-12345678   
 要求   
 把-后面或前面的放到quhao字段里。。谢谢
------解决方案--------------------update 表user  set quhao=right(字段tel,len(字段tel)-charindex( '- ',字段tel)),字段tel=left(字段tel,charindex( '- ',字段tel)-1)
------解决方案--------------------呵呵,應該是這樣: 
 update [user]  set tel=right(tel,len(tel)-charindex( '- ',tel)),quhao=left(tel,charindex( '- ',tel)-1)
------解决方案--------------------选出符合条件的记录后,什么都可以做   
 select col1=left(tel,charindex( '- ',tel)-1), 
        col2=right(tel,len(tel)-charindex( '- ',tel)) 
 from user 
 where charindex( '- ',tel)> 0
------解决方案--------------------表user  字段tel   
 010-12345678   
 要求   
 把-后面或前面的放到quhao字段里。。谢谢   
 取-前面的数据:select left(tel , charindex( '- ',tel) -1) from user 
 取-后面的数据:select substring(tel , charindex( '- ',tel) + 1 , len(tel)) from user