Created
January 9, 2023 17:19
-
-
Save FlameWert/99551b1c7ceed2ba9ad8ec420f24453a to your computer and use it in GitHub Desktop.
Find text occurrence in SQL Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @tosearch VARCHAR(MAX)='In' | |
SELECT (DATALENGTH(@string)-DATALENGTH(REPLACE(@string,@tosearch,'')))/DATALENGTH(@tosearch) | |
AS OccurrenceCount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment