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 adventureworkslt tables are related?
Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?
Explain steps of normalization?
What is difference between inner join and join?
How to drop existing views from a database in ms sql server?
What is the process of normalising?
Do you know what is blocking?
What is the difference between lock, block and deadlock? : sql server database administration
What is standby servers? Explain types of standby servers.
What is serializable?
What are the requirements for sql server 2016?
Explain few examples of RDBMS?
What are out-of-range errors with date and time literals?
1.what are diff types of joins , and explain diff between cross join and full outer join 2.diff types of views 3. Diff types of index 4. What is diff b/w stores procedure and function procedure 5.diff between double and int in SQL 6.diff between char and varchar in SQL. 7.Oracle or SQL whice you will preferred and why.
you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration