CREATE FUNCTION f_EmailExists (@vcEmail varchar(100))RETURNS tinyint ASBEGINDECLARE @tiResult TINYINTIF EXISTS (SELECT * FROM USERS WHERE FIELD1=@vcEMAIL) OR EXISTS (SELECT * FROM USERS WHERE FIELD2=@vcEMAIL) SET @tiResult=1ELSE SET @tiResult=0RETURN @tiResultEND
In your ASP page:szSQL="select dbo.f_EmailExists('" & szEmail & "') as valid"' (open the recordset, however you choose to do that)iEmailValid=CInt(RS("valid"))Be sure to set permissions on the function so the user your ASP page is logging in as can run it. Alternatively, you could use a stored procedure, with almost identical code. I'd use a function here because it's possible you'd want to use the function in another query later.Cheers-b