本文介绍了如何在SQLServer 2008中对字符串进行Cancatinate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

在Sqlserver中,我想对一个字符串进行结尾,字符串名称是AnilKumar,我想计算AnilKumar中有多少个A.在AnilKumar字符串中,结果应该是两个A.

输出:A''s = 2名称应变为nilkumr


请提出一些建议,


问候,

AnilKumar.D

Dear Friends,

Here in Sqlserver i want to ConCatinate One String,The String name is AnilKumar i want to Count How many A''s in AnilKumar.In AnilKumar String there are two A''s the Result should Come.

Output: A''s=2 name should become nilkumr


Please suggest some suggestions,


Regards,

AnilKumar.D

推荐答案

SELECT 'ls'+cast(LEN(Customername ) - LEN(REPLACE(Customername , 'l', '')) as varchar(50)) from Customer WHERE (Customername = 'SunilSunilAnil')

..请尝试


SELECT 'A''s' + CONVERT( varchar(100), (SELECT COUNT(*) 
                                       FROM TableName
                                       WHERE ColumnName = 'A'))
...


这篇关于如何在SQLServer 2008中对字符串进行Cancatinate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 18:59