views:

611

answers:

1

My create view code like this

create VIEW [dbo].[vw_test]
AS
SELECT     'B' AS rtype, ID FROM TB_A
UNION ALL
SELECT     'V' AS rtype, ID FROM TB_B
GO

How to create a PK with. I need to do full-text search. Tks

+1  A: 

Normally, you could create a unique clustered index on a view, but not an actual primary key constraint. Article here.

However, the SQL in the view contains a UNION so you can't do this.

gbn
Thanks. My answer added nothing to the discussion so deleted.
Learning