SQL SERVER - Alternative to Like Condition

SQL SERVER - Alternative to Like Condition

DECLARE @Acc TABLE
(
ID  int,
AccountName Varchar(200)
)

Insert into @Acc (ID,AccountName)  Values
(1,'Switin Kotian'),(2,'Jitesh Shiyal'),(3,'Ramesh Bangera'),(4,'Shrikant Chavan'),(5,'Dipti Patil'),(6,'Bhan Asher'),(7,'Smruti Kotian')

Select * From @Acc
Select * From @Acc Where AccountName Like 'S%'
Select * From @Acc Where CharIndex('S',AccountName) = 1
Select * From @Acc Where Left(AccountName,1) = 'S'
Select * From @Acc Where SUBSTRING(AccountName,1,1) = 'S'


Comments

Popular posts from this blog

Shared / Static Class in vb.net/C#

Xamarin Forms : PopUp Page with RG.Plugins.Popup

Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard)