@
기호까지 클라이언트의 전자 메일 주소를 기반으로 SQL Server 2008의 저장 프로 시저에서 클라이언트의 정보를 요청하는 ASP.net이 있습니다. 이 소규모 조직에서 3 개월이 지나면 고객이 자주 변경되기 때문에 이메일 주소는 동일하게 유지됩니다.SQL Server 저장 프로 시저 전자 메일 확인
예. 이메일 주소가 [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
이메일 주소는 항상이 경우 숫자 등 4
에 의해 다음 다음 밑줄 _
in
같은 부서 정보 기술의 이름과 다음 obois
시작합니다. 예 : [email protected]