Posts

Showing posts from May, 2012

Count Number Of Spaces in a String

Hello readers. Below is a simple query to count number of spaces from a string. DECLARE @string VARCHAR ( 200 ) = 'hello how are you' SELECT ( LEN ( @string ) - LEN ( REPLACE ( @string , ' ' , '' ))) Occurence