Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How adventureworkslt tables are related?

984


Explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?

1186


Explain steps of normalization?

1067


What is difference between inner join and join?

1096


How to drop existing views from a database in ms sql server?

1147


What is the process of normalising?

1049


Do you know what is blocking?

996


What is the difference between lock, block and deadlock? : sql server database administration

1094


What is standby servers? Explain types of standby servers.

1058


What is serializable?

1090


What are the requirements for sql server 2016?

934


Explain few examples of RDBMS?

1102


What are out-of-range errors with date and time literals?

1095


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.

1664


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

1161