TSQL foreign keys on views?

后端 未结 11 1062
臣服心动
臣服心动 2021-01-01 13:51

I have a SQL-Server 2008 database and a schema which uses foreign key constraints to enforce referential integrity. Works as intended. Now the user creates views on the orig

11条回答
  •  爱一瞬间的悲伤
    2021-01-01 14:29

    Something like this in View2 is probably your best bet:

    CREATE VIEW View2
    AS
         SELECT
              T2.col1,
              T2.col2,
              ...
         FROM
              Table2 T2
         INNER JOIN Table1 T1 ON
              T1.pk = T2.t1_fk
    

提交回复
热议问题