我有一个从存储过程要求的客户的信息在基于客户端的电子邮件地址,直到@
标志SQL Server 2008的一个ASP.net。由于在这个小型组织中,客户经常在3个月后改变,但电子邮件地址保持不变。SQL Server存储过程的电子邮件验证
E.g.一个电子邮件地址为[email protected]
的客户在3-4个月后完成合同,然后将该电子邮件地址分配给其他人。
现在,这里是我的问题:我想我的存储过程才能找到客户信息后,他/她进入obois_in4
,并按下按钮Search
。我不希望他们输入整个电子邮件的原因是因为它太长,其次他们可以在输入时出错,但打字如obois_in4
不是什么大问题。
我写的可以按名称搜索客户端的代码,但同样,客户总是后3-4个月改变,但电子邮件地址保持不变。
ALTER PROCEDURE [dbo].[sp_find_client_information]
-- Add the parameters for the stored procedure here
@client_email varchar (50) = null
AS Declare @numOfRows int BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT @numOfRows = COUNT (*)
From helpdesk_clients
Where --change first name and
client_firstName = @client_email or client_lastName = @client_email;
begin
if (@numOfRows = 0)
select @numOfRows;
else if (@numOfRows = 1)
select
client_id,
client_firstName,
client_lastName,
client_work_email,
client_work_phone,
client_work_phone_ext,
client_office,
dept_nom,
client_position
from
helpdesk_clients join departments
on
helpdesk_clients.dept_id = departments.dept_id
where client_firstName like '%'[email protected]_email+'%';
end
END
的电子邮件地址总是obois
加上下划线_
再系信息技术为in
的名称,然后在这种情况下,数字等4
开始。例如[email protected]