In SQL Server 2005, 2008, 2012 for email validation I found that either you can write a plane query as below :
Or can write a function as below : "
Reference: Govind Badkur(http://sqlserver20.blogspot.com)
SELECT * FROM people WHERE email NOT LIKE '%_@__%.__%'
Or can write a function as below : "
CREATE FUNCTION dbo.ValidateEmail(@EMAIL VARCHAR(100)) RETURNS BIT AS BEGIN DECLARE @bitRetVal AS BIT IF (@EMAIL <> '' AND @EMAIL NOT LIKE '_%@__%.__%') SET @bitRetVal = 0 -- Invalid ELSE SET @bitRetVal = 1 -- Valid RETURN @bitRetVal END
Reference: Govind Badkur(http://sqlserver20.blogspot.com)
No comments:
Post a Comment