/** Daily Alter Scripts Deven **/ /*Add Alter Scripts here and check in File on daily Basis Format: Module Name: Provider Logo Feature Developer: Pratik J Date:07/07/2016 Alter table Add column; */ -- ================================================ -- Template generated from Template Explorer using: -- Create Scalar Function (New Menu).SQL -- -- Use the Specify Values for Template Parameters -- command (Ctrl-Shift-M) to fill in the parameter -- values below. -- -- This block of comments will not be included in -- the definition of the function. -- ================================================ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: -- Create date: -- Description: -- ============================================= Create Function dbo.[FN_FIRST_LETTER_FROM_WORD] ( @String Varchar(Max) -- Variable for string ) RETURNS Varchar(Max) BEGIN Declare @Xml Xml Declare @firstletter Varchar(Max) Declare @delimiter Varchar(5) SET @delimiter=' ' SET @Xml = cast((''+replace(@String,@delimiter,'')+'') AS XML) ;With CTE AS (SELECT A.value('.', 'varchar(max)') as [Column] FROM @Xml.nodes('a') AS FN(a) ) SELECT @firstletter =Stuff((SELECT '' + LEFT([Column],1) FROM CTE FOR XML PATH('') ),1,0,'') RETURN (@firstletter) END GO