我正在编写以下 SQL 过程:
ALTER PROCEDURE [dbo].[spc_InsertSubjectToContentRelation]
(
@pCourseGUID XML,
@pSubjectId XML,
@pAssessmentIds XML,
@pVideoIds XML
)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @CourseGUID NVARCHAR(50);
DECLARE @SubjectId NVARCHAR(50);
DECLARE @AssessmentIds NVARCHAR(MAX);
DECLARE @VideoIds NVARCHAR(MAX);
SET @CourseGUID = Convert(NVARCHAR,@pCourseGUID);
SET @SubjectId = Convert(NVARCHAR,@pSubjectId);
SET @AssessmentIds = Convert(NVARCHAR,@pAssessmentIds);
SET @VideoIds = Convert(NVARCHAR,@pVideoIds);
INSERT INTO SubjectToAssessmentAndVideoRelation VALUES (@pCourseGUID, @pAssessmentIds, @pAssessmentIds, @pVideoIds)
END
当我运行此过程时,我收到错误:
不允许从数据类型 xml 到 nvarchar 的隐式转换。使用 CONVERT 函数运行此查询。我该如何解决这个问题?