sqlserver 一个字段分成两个字段 截取,保存

 

 

Ma,LeiTo(Ma,lT)

分割后为

姓               名

Ma,LeiTo        Ma,lT

 

SELECT  LEFT(作者, CHARINDEX('(', 作者) - 1) AS 姓 ,
        replace( STUFF(作者,1, CHARINDEX('(', 作者) , ''),')','') AS 名 ,*  
FROM     作者表

 

 

删除最大值

delete from 表 where id in( 
 SELECT id FROM dbo.表 T  
WHERE EXISTS (SELECT name FROM dbo.表 WHERE name= T.name  GROUP BY name HAVING COUNT(*) > 1)  
AND T.id NOT IN (SELECT MIN(id) FROM dbo.M期刊 GROUP BY  name HAVING COUNT(*) > 1)  
)

 

去除特殊空格

REPLACE(REPLACE(REPLACE(REPLACE(Title,' ',''),CHAR(9),''),CHAR(10),''),CHAR(13),'')

 

posted @ 2017-05-15 17:56  荧屏  阅读(918)  评论(0编辑  收藏  举报