如要把一个bit类型的变量@num转化为varchar类型:convert(varchar(4),@num)。
CREATE PROCEDURE [dbo].[sp_News_DeleteCategory1]
@CategoryID Nvarchar(160),
@IsDeleted bit
AS
BEGIN
DECLARE @sql Nvarchar(260)
SET @sql='UPDATE News_Categories SET IsDeleted=' + CONVERT(varchar(4),@IsDeleted) + 'WHERE CategoryID IN ('+ @CategoryID +')'
--PRINT @sql
EXECUTE(@sql)
END
注:其中应用到了IN指令。