create proc Proc_GetOrderInfo_ByStatus ( @Flag int ) as declare @Msql varchar(1024) set @Msql = 'select * from vw_aspnet_OrderInfo where 1=1 ' if(@Flag=1) set @Msql = @Msql + 'and IsConfirm = ''false''' else if(@Flag=2) set @Msql = @Msql + 'and IsConfirm = ''true''' else if(@Flag=3) set @Msql = @Msql + 'and IsConsignment = ''false''' else if(@Flag=4) set @Msql = @Msql + 'and IsConsignment = ''true''' else if(@Flag=5) set @Msql = @Msql + 'and IsPayment = ''false''' else if(@Flag=6) set @Msql = @Msql + 'and IsPayment = ''true''' else if(@Flag=7) set @Msql = @Msql + 'and IsPigeonhole = ''false''' else if(@Flag=8) set @Msql = @Msql + 'and IsPigeonhole = ''true''' exec(@Msql)比如其中'and IsPigeonhole = true',实际上我需要的true是一个字符串,所以写成:'and IsPigeonhole = ''true'''
在sql server 2005中的单引号包含单引号的写法
最新推荐文章于 2021-05-17 16:11:04 发布