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
 General SQL Server Forums
 New to SQL Server Programming
 checking duplicates

Author  Topic 

sparrow37
Posting Yak Master

148 Posts

Posted - 2010-10-23 : 11:29:25
Hi all:

I have webpage where I have a form which user will fill to create a user. I want to check if username and email address being used are not already registered. I want all this done with one query. How can I do this.

Regards,
Asif Hameed

Sachin.Nand

2937 Posts

Posted - 2010-10-23 : 11:45:23
You can use

If exists(select username,email from table where username=@username or email=@email)
print 'username or email registered'
else
print 'valid username and email'



PBUH

Go to Top of Page
   

- Advertisement -