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
Explain why variables called the most powerful component of ssis?
Write an sql query for deleting duplicate rows?
In what three ways is the return statement used in a stored procedure?
what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
What is usually the first word in a sql query?
How to list all user defined functions in the current database?
Explain “not null constraint” in sql server?
Explain the functionalities that views support?
Difference between Logical Page and Physical Page in SSRS.
What is normalization of database?
What is the rdl file?
How to provide login information for a new odbc dsn?
What is query and its types?
Define model database?
Why use identity in sql server?