set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go /***************************************************** ** PROCEDURE : pro_get_so_cust_list ** DECRIPTION: 获取客户列表 ** DATE : 2012-07-11 ** VERSION AUTH DATE DESC ** -------- ------------ ------------ ----------------- ** V000.0.1 pukuimin 2012-07-11 新建程序 ** -------- ------------ ------------ ----------------- *******************************************************/ ALTER procedure [dbo].[pro_get_so_cust_list]( @stat varchar(20) --状态 )as begin declare @sql_str varchar(2000), @stat_str varchar(20) set @sql_str = 'select cast(cust.cust_cd as varchar(20)) as code, -- 用户ID cust.cust_nam as name-- 名称 from t_so_cust_info cust where 1=1 ' if isnull(@stat, '') <> '' begin set @sql_str = @sql_str + ' and cust.stat = '''+@stat+'''' end print @sql_str exec(@sql_str) end