Is it possible to have a if condition in VIEWS
eg
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
No I don’t believe this is possible.
You could use a stored procedure instead to achieve this functionality.