adspace
How can count the string ?
for ex: If i have string like 'bhaskar' then i need like
b:1
h:1
a:2
s:1
k:1
r:1
please give any idea on that
Answer Posted / suni soni
In SQL Server 2005 New query window for any database.
declare @CharVal varchar(100),@i int
declare @temp table (CharVal varchar(10))
set @a='Bhaskar'
set @i=1
while (@i<=len(@a))
begin
insert into @temp values (substring(@a,@i,1))
set @i=@i +1
end
select CharVal, count(*) from @temp group by CharVal
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
How do I find query history in sql server?
What is a scheduled job or what is a scheduled task?
You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?
What are the different types of subquery?
What are the different SQL Server Versions you have worked on?
Disadvantages of the indexes?
What is in place upgrade in sql server?
When should you use an instead of trigger?
How to connect php with different port numbers?
How to enter binary string literals in ms sql server?
What is a view in sql?
What is the difference between upgrade and migration in sql server?
What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?
List the ways in which dynamic sql can be executed?
do you know how to configure db2 side of the application? : Sql server database administration