USP_PAGEVIEWDATA_ADDPAGEVIEWSFROMTEMPDATA
The save procedure used by the add dataform template "PageViewData Add From Temp Data 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. |
@TEMPID | uniqueidentifier | IN | Temp ID |
@SESSIONID | nvarchar(36) | IN | Session ID |
@MAXRECORDS | int | IN | Maximum number of page views to track. User 0 for no limit. |
Definition
Copy
CREATE procedure dbo.USP_PAGEVIEWDATA_ADDPAGEVIEWSFROMTEMPDATA
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@TEMPID uniqueidentifier = null,
@SESSIONID nvarchar(36) = null,
@MAXRECORDS int = 0
)
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
declare @TEMP table (BinaryData image, TextData ntext)
insert into @TEMP
exec [dbo].[spTempDataFetch] @TEMPID
declare @XMLDATA xml
set @XMLDATA = (select top 1 TEXTDATA from @TEMP)
declare @XMLTOADD xml
set @XMLTOADD = (select @XMLDATA.query('/PageViews/Pg[@SID=sql:variable("@SESSIONID")]'))
if @XMLTOADD is not null
exec dbo.USP_PAGEVIEWDATA_ADDPAGEVIEW @ID, @CHANGEAGENTID, @XMLTOADD, @MAXRECORDS
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0