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 2000 Forums
 SQL Server Development (2000)
 Validating email Addresses in a database on input

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-23 : 12:58:28
Scott writes "Have a large number of users inputting data into a large database, in which customer details are captured along with company details. The problem being is that they keep putting the e-mail address in the web address fields and vice versa.

I need to create a script that runs on these fileds that basically would be the following...

Please note...the * represents the actual field name

If
(*email address contains 'www.', then msgBox = "This is not an email address - it is a website address")
Else if
(*web address contains '@', then msgBox = "This is not a valid website address - it is an email address"
End if"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-04-23 : 18:33:26
In SQL Server, you could do this with charindex, but that seems a little late in the process. I would suggest you look into some data validation processes like using client-side JavaScript to check the form contents BEFORE the form can be submitted. Otherwise you'll be catching this error really late in the process and it will be harder to rollback and raise the error message.

Go to Top of Page
   

- Advertisement -