Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 return the number of times a char

Author  Topic 

djokerss
Starting Member

28 Posts

Posted - 2004-08-23 : 05:21:59

i have a field with data like this :
A;AB;ABC;ABCDE

i want to counting return the number of time (';' or
another char in that field.

with this sample it return 3 when i ask ';'

anyone can help me the syntact for than ?

nr
SQLTeam MVY

12543 Posts

Posted - 2004-08-23 : 05:25:00
select len(@str) - len(replace(@str,';','')


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-23 : 05:37:37
nigel: i must say this is a great idea. this would never occur to me.... ok maybe in moment of enlightement :))

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

djokerss
Starting Member

28 Posts

Posted - 2004-08-23 : 21:39:45
thanks nr for your repply...it help me so much..
Go to Top of Page
   

- Advertisement -