【发布时间】:2019-03-13 16:19:07
【问题描述】:
您好,我正在尝试创建一个存储过程来快速添加联系人。我有多个表并相应地加入它们。我的参数是 StudentEmail、EmployeeName、ContactDetails 和 ContactType。如果有人可以帮助我,我在插入语句时遇到问题。
Drop Procedure if exists usp_addQuickContacts
Go
Create Procedure usp_addQuickContacts
@StudentEmail nchar(50) = NULL,
@EmployeeName nchar (50) = NULL,
@ContactDetails nchar (50) = NULL,
@ContactType nchar(50) = NULL
AS
Begin
Insert Into StudentContacts
(
ContactID,
StudentID,
ContactTypeID,
ContactDate,
EmployeeID,
ContactDetails
)
From StudentInformation inner join StudentContacts
On StudentInformation.StudentID = StudentContacts.StudentID
Inner Join Employees
On StudentContacts.EmployeeID = Employees.EmployeeID
End
Go
【问题讨论】:
标签: sql-server tsql join stored-procedures parameters