Getting List of Names which starts with numeric
-
Hi, I have a column in table 'str_Name'of type string. It contains the data as shown below. Vishnu Rajesh 12Sharma 02Santhosh 34657Chandu Anita Swapna 987fhug Deepika Divya Janaki My requirement is to get names which starats with numerics Please suggest me how to achieve this. Thanks in Advance
-
Hi, I have a column in table 'str_Name'of type string. It contains the data as shown below. Vishnu Rajesh 12Sharma 02Santhosh 34657Chandu Anita Swapna 987fhug Deepika Divya Janaki My requirement is to get names which starats with numerics Please suggest me how to achieve this. Thanks in Advance
See my blog post[^] You need to map a .NET function to SQL to do this. The starting point is what string methods[^] are supported as translatins to SQL in LINQ? There isn't a way to map a function such as char.IsNumeric I think, so I found this solution (using VB.NET)
'Create a char array using digits
dim digits as char() = "0123456789"
dim query = from x in myTable _
where digits.Contains(x.str_Name.Substring(0,1)) _
select xTested on LINQpad and it works! You might need a not null clause if any str_name is null or blank.
'Howard