USE [MuseumDB]
GO
/****** 对象: StoredProcedure [dbo].[GetOperBySelect_sp] 脚本日期: 02/25/2013 14:20:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[GetOperBySelect_sp]
@OperatorName varchar(50),
@RoleID int
AS
BEGIN
declare @sql nvarchar(1000)
set @sql = 'select OperatorID,OperatorName,OperatorPwd,o.RoleID,r.RoleName,o.memo from tb_operator o left join tb_role r on o.RoleID = r.RoleID where 1= 1'
if(isnull( @OperatorName,'') <> '')
set @sql = @sql + ' and OperatorName like ''%'+ @OperatorName+'%'''
if( isnull( @RoleID,0) <> 0)
set @sql = @sql + ' and o.RoleID = '+ @RoleID + ''
exec(@sql)
END