Below is the variable in Oracle I need to convert in SQL Server please suggest.
V_BAD_EMAIL_CNT NUMBER := REGEXP_COUNT(pv_bad_emails,',') + 1;
Below is the variable in Oracle I need to convert in SQL Server please suggest.
V_BAD_EMAIL_CNT NUMBER := REGEXP_COUNT(pv_bad_emails,',') + 1;
This will return the number of comma's in the string + 1 in SQL
declare @pv_bad_emails varchar(1000);
set @pv_bad_emails = 'a,b,c,d';
select len(@pv_bad_emails) - len(replace(@pv_bad_emails, ',', '')) + 1
For more reference
How do you count the number of occurrences of a certain substring in a SQL varchar?