mercredi 27 juillet 2016

How to get count of availible guid from a comma separated string of guid

Declare @i int;
declare @stringOfGuids nvarchar(max)='''70173C2D-0B8E-4043-BD14-665D5DCCF112'',''B0B7445C-DF50-4D49-BD4E-B74958FB0618''
,''70173C2D-0B8E-4043-BD14-665D5DCCF112''';

as i have above string and here i need to count number of availible guid which is three. how can i get it in a Integer varible

Something like this ??

select @i= count(@stringOfGuids)

but it gives me 1 , need three as available guids are 3

Aucun commentaire:

Enregistrer un commentaire