T-SQL: Opposite to string concatenation – how to split string into multiple records [duplicate]

There are a wide varieties of solutions to this problem documented here, including this little gem: CREATE FUNCTION dbo.Split (@sep char(1), @s varchar(512)) RETURNS table AS RETURN ( WITH Pieces(pn, start, stop) AS ( SELECT 1, 1, CHARINDEX(@sep, @s) UNION ALL SELECT pn + 1, stop + 1, CHARINDEX(@sep, @s, stop + 1) FROM Pieces … Read more

How to strip HTML tags from a string in SQL Server?

There is a UDF that will do that described here: User Defined Function to Strip HTML CREATE FUNCTION [dbo].[udf_StripHTML] (@HTMLText VARCHAR(MAX)) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @Start INT DECLARE @End INT DECLARE @Length INT SET @Start = CHARINDEX(‘<‘,@HTMLText) SET @End = CHARINDEX(‘>’,@HTMLText,CHARINDEX(‘<‘,@HTMLText)) SET @Length = (@End – @Start) + 1 WHILE @Start > 0 AND … Read more

Login failed for user ‘DOMAIN\MACHINENAME$’

NETWORK SERVICE and LocalSystem will authenticate themselves always as the correpsonding account locally (builtin\network service and builtin\system) but both will authenticate as the machine account remotely. If you see a failure like Login failed for user ‘DOMAIN\MACHINENAME$’ it means that a process running as NETWORK SERVICE or as LocalSystem has accessed a remote resource, has … Read more