FUNCTION [dbo].[EmployeesMissingDocs] (
@EmployeeID int,
@Title varchar(50) = null,
@LicenseNumSignedYN bit = null,
@LicenseExpires DATETIME= null,
@BclsExpires DATETIME= null
) RETURNS VARCHAR(2000)
dbo.CoreMandatory RIGHT OUTER JOIN
dbo.Employeestbl ON dbo.CoreMandatory.EmployeeID = dbo.Employeestbl.ID LEFT OUTER JOIN
dbo.Facilitiestbl LEFT OUTER JOIN
dbo.FacilitiesDocumentsRequirements ON dbo.Facilitiestbl.ID = dbo.FacilitiesDocumentsRequirements.FacilityID RIGHT OUTER JOIN
dbo.TovInfo ON dbo.Facilitiestbl.Tov_ID1 = dbo.TovInfo.TovCode ON dbo.Employeestbl.ID = dbo.TovInfo.EmployeeID
The UDF really doesn't care where the parameters come from.Well if they would all come from one table (let say EmployeesJcahoInfo), I would have no problem executing it like this
Update EmployeesJcahoInfo.EmployeeID set MyField = False where EmployeesMissingDocs (EmployeesJcahoInfo.Field1,EmployeesJcahoInfo.Field2,EmployeesJcahoInfo.Field3..) = '1')
The whole issue is how to get those parameters supplied, and if I try to do this on a joined sql results then it becomes non updatable.write the update statement without relying on the UDF......WHERENot sure what you mean by that, as the where condition is the point I need to use the UDF for?
condition(s)
SQL Server allows you to join tables in an UPDATE statementAre you saying I can have all those outer joins shown above (ID: 41738208) embedded in this update statement?