ssandu:Cum pot sa fac urmatorul select (acum da eroare)
SELECT * from tabel
WHERE utilizator IN
CASE
WHEN USER_NAME() = 'user1' THEN ('user1', 'user2')
WHEN USER_NAME() = 'user3' THEN ('user3', 'user2')
DEFAULT USER_NAME()
END
Se poate ?
Poti pleca de la urmatoarea solutie (ce-i bazaconia aia cu DEFAULT ?):
CREATE TABLE ListaUtilizatori
(
Utilizator VARCHAR(25),
Lista VARCHAR(25)
);
GO
INSERT INTO ListaUtilizatori VALUES('user1','user1')
INSERT INTO ListaUtilizatori VALUES('user1','user2')
INSERT INTO ListaUtilizatori VALUES('user3','user3')
INSERT INTO ListaUtilizatori VALUES('user3','user2')
GO
SELECT *
FROM tabel
WHERE utilizator IN (SELECT Lista FROM ListaUtilizatori WHERE Utilizator = USER_NAME())