日期:2014-05-17 浏览次数:20453 次
CREATE PROCEDURE TESTT
(
@Age int
)
AS
;WITH TEST AS
(
SELECT * FROM INFO
)
IF @Age<18
BEGIN
SELECT * FROM TEST WHERE Age<18
END
ELSE IF @Age=18
BEGIN
SELECT * FROM TEST WHERE Age=18
END
ELSE
SELECT * FROM TEST WHERE Age>18
CREATE PROCEDURE TESTT
(
@Age int
)
AS
begin
;WITH TEST AS
(
SELECT * FROM INFO
)
select * from test where age<18 and @age<18
union all
select * from text where age=18 and @age=18
union all
select * from text where age>18 and @age>18
end
CREATE PROCEDURE TESTT
(
@Age int
)
AS
;WITH TEST AS
(
SELECT * FROM INFO
)
SELECT
*
FROM TEST
WHERE (Age<18 AND @Age<18)
OR (Age=18 AND @Age=18)
OR (Age>18 AND @Age>18)