例如
CREATE VIEW as DECLARE @Count int SET @Count=-1 select @Count=EmpID from EmployeeDetails where ID=200 IF @Count=-1 BEGIN SELECT * FROM TEAM1 END ELSE BEGIN SELECT * FROM TEAM1 END
您可以使用存储过程来实现此功能.