The solution I found was to create a new view with a unique index on it, and happily this works in standard edition too!
These are the steps I took:
- CREATE VIEW vwLobbyGameType
WITH SCHEMABINDING
AS
SELECT L.lobbyId, TSGT.gameTypeId
FROM dbo.Lobby L
INNER JOIN dbo.LobbyTableSet LTS
ON L.lobbyId = LTS.lobbyId
INNER JOIN dbo.TableSetGameType TSGT
ON LTS.tableSetId = TSGT.tableSetId
GO - SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
GO
CREATE UNIQUE CLUSTERED INDEX [CIX_vwLobbyGameType]
ON vwLobbyGameType(lobbyId,gameTypeId)
GO
Msg 2601, Level 14, State 1, Line 1
Cannot insert duplicate key row in object 'dbo.vwLobbyGameType' with unique index 'CIX_vwLobbyGameType'.
The statement has been terminated.
It works!!! :)