if OBJECT_ID('CountWords') is not null drop function dbo.CountWords go create function dbo.CountWords ( @input nvarchar(1000) ) returns int as begin declare @result int = 0 set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'a', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'b', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'c', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'd', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'e', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'f', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'g', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'h', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'i', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'j', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'k', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'l', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'm', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'n', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'o', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'p', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'q', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'r', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 's', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 't', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'u', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'v', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'w', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'x', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'y', '') set @input = REPLACE(@input COLLATE SQL_Latin1_General_CP1_CS_AS, 'z', '') return len(@input) end
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.