USP_SEARCHPART_CLIENTSITES_BULK_ADD
The save procedure used by the add dataform template "SearchPart_ClientSites Bulk Add Data Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@SEARCHPARTID | int | IN | Input parameter indicating the context ID for the record being added. |
@XMLDATA | xml | IN | XML Data |
Definition
Copy
CREATE procedure dbo.USP_SEARCHPART_CLIENTSITES_BULK_ADD
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@SEARCHPARTID int,
@XMLDATA xml = null
)
as
set nocount on;
if @ID is null
set @ID = newid()
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
begin transaction
delete from dbo.SEARCHPART_CLIENTSITES where SEARCHPARTID = @SEARCHPARTID
if @XMLDATA.exist('/ids/id') = 1
begin
insert into dbo.SEARCHPART_CLIENTSITES ([SEARCHPARTID],[CLIENTSITESID],[ADDEDBYID],[CHANGEDBYID],[DATEADDED],[DATECHANGED])
select
@SEARCHPARTID,
IDS.ID.value('@value', 'int'),
@CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE
from @XMLDATA.nodes('/ids/id') IDS(ID)
end
commit
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0