CREATE PROCEDURE AView
@a nvarchar(100) ,
@b nvarchar(100)
AS
SELECT
c,d,e
FROM table
WHERE c like '[email protected]% ' OR d like '[email protected]% ' ORDER BY e
GO
这个存储过程正确应该如何写?
------解决方案--------------------
CREATE PROCEDURE AView
@a nvarchar(100) ,
@b nvarchar(100)
AS
SELECT c,d,e
FROM table
WHERE c like '% '[email protected]+ '% ' OR d like '% '+@+ 'b% '
ORDER BY e
GO
------解决方案--------------------
CREATE PROCEDURE AView
@a nvarchar(100) ,
@b nvarchar(100)
AS
exec( 'SELECT
c,d,e
FROM table
WHERE c like ' '% '[email protected]+ '% ' ' OR d like ' '% '[email protected]+ '% ' ' ORDER BY e ')
GO
------解决方案--------------------
create table t(ID varchar(20),date datetime)
insert t select '001 ', '2006/02/02 '
union all select '001 ', '2006/02/05 '
union all select '002 ', '2006/05/02 '
union all select '002 ', '2006/05/05 '
go
select * from t
create procedure pr_1
@a varchar(20)
as
select * from t where ID like '% '[email protected]+ '% '
exec pr_1 1