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
What is the full meaning of dml?
How will you hide an attribute? : sql server analysis services, ssas
What are the types of indexes?
how you can deploy an ssrs report?
What is spatial and temporal data?
Help!!!!!!!!!!!! My database has gone offline, it is highlighted as 'Suspect'. Foolishly, i haven't got a recent back up. Is there a way of quickly restoring the database? Thank you
how to avoid cursors? : Sql server database administration
How to create a simple table to test triggers in ms sql server?
What is the stuff and how does it differ from the replace function?
What is difference between temp table and cte?
Do you know what are different types of replication in sql server?
What is nonclustered index with included columns ?
Explain tables in SQL Azure?
What are the essential components of sql server service broker?
List the different types of collation sensitivities in sql server?