TSQL foreign keys on views?

后端 未结 11 1063
臣服心动
臣服心动 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:22

    Another approach, depending on your requirements, would be to use a stored procedure to return two recordsets. You pass it filtering criteria and it uses the filtering criteria to query table 1, and then those results can be used to filter the query to table 2 so that it's results are also consistent. Then you return both results.

提交回复
热议问题