CREATE FUNCTION ReplaceString
(
@pString VARCHAR(MAX)
)
RETURNS VARCHAR(MAX)
AS BEGIN
DECLARE @replaceString VARCHAR(MAX)
SET @replaceString = REPLACE(@pString,':','');
SET @replaceString = REPLACE(@replaceString,'->','');
SET @replaceString = REPLACE(@replaceString,';','');
RETURN @replaceString;
END
Code (SQL)
SELECT dbo.ReplaceString(ColumnName) ....
การสร้าง Function บน Server Database (SQL Server : Function)