------------------------1
CREATE VIEW view_mt_pch_trademark
WITH SCHEMABINDING
AS
SELECT notes
FROM dbo.mt_pch_trademark
WHERE notes IS NOT NULL
GO
CREATE UNIQUE CLUSTERED INDEX INX_view_mt_pch_trademark
ON view_mt_pch_trademark(notes)
-----------------------------2
CREATE TABLE Table1
(cID INTEGER PRIMARY KEY
, c1 INTEGER NULL
, foolme AS (CASE WHEN c1 IS NULL THEN cID END)
, CONSTRAINT cc1 UNIQUE (c1,foolme)
)
INSERT INTO Table1
SELECT 1, 1
UNION ALL
SELECT 2, NULL
UNION ALL
SELECT 3, NULL
SET NOCOUNT OFF
SELECT * FROM Table1
Hiç yorum yok:
Yorum Gönder