SQL 动态拼接SQL 语句
USE [PMS_UnifiedDB_15] GO /****** Object: StoredProcedure [dbo].[SP_GetLogInfo] Script Date: 2/11/2015 3:04:13 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Alter date: <Alter Date,,> -- Description: <Description,,> -- ============================================= ALTER PROCEDURE [dbo].[SP_GetLogInfo] -- Add the parameters for the stored procedure here @id bigint, @userRoleInput nvarchar(50) AS BEGIN SET NOCOUNT ON; declare @query nvarchar(max); set @query =‘select * from dbo.COM_Function where function_label=‘‘‘+@userRoleInput+‘‘‘‘; print @query exec sp_executeSql @query END
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。