Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 email id validation

Author  Topic 

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-06-13 : 06:12:16
How can we validate email id in sql server 2005..

i use the following code...

if((len(@default_to_mail)-len(replace(@default_to_mail,' ','')))=0 and @default_to_mail like ('%@%.%'))

its not validating correctly...
can u give me any solution.


Thanks in advance.


cool...,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-13 : 06:19:28
You want to validate while retrieving from db? Better to do this validation at your clint side before saving it by means of scripting language like javascript.And if you want to do it in SQL, i think you could use CLR functions.
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2008-06-13 : 06:22:40
http://vyaskn.tripod.com/handling_email_addresses_in_sql_server.htm

.. but its always better to do all this validations at the client side.. as you get lots of tools available for it.

Chirag

http://www.chirikworld.com
Go to Top of Page

dass05555
Yak Posting Veteran

55 Posts

Posted - 2008-06-13 : 06:23:27
Do u hav any CLR function like this.

cool...,
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-13 : 06:29:45
Wouldn't

if @default_to_mail like '%@%.%' and @default_to_mail not like '%[ ]%'

be easier to use? instead of

if ((len(@default_to_mail)-len(replace(@default_to_mail,' ','')))=0 and @default_to_mail like ('%@%.%'))



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -