October 8, 2010 at 9:34 am
Can these not go across databases? I tried below
CREATE VIEW VT WITH SCHEMABINDING AS SELECT
p.patid,p.facid,p.patstatus,f.mardbname
from dbo.patients p inner join fac.dbo.facilities f on p.facid = f.facid
and I get
Msg 4512, Level 16, State 3, Procedure VT, Line 1
Cannot schema bind view 'VT' because name 'fac.dbo.facilities' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.
October 8, 2010 at 9:45 am
you are correct; a schemabound vie can only reference objects in the same database; that jump to the parallel table in the database "fac" is preventing the schemabinding...
Lowell
October 8, 2010 at 10:03 am
Is an indexed view allowed without the schemabinding?
October 8, 2010 at 10:36 am
I am very sure it is not; an indexed view requires, among other things, that all the tables be schemabound...but that doesn't prevent you from creating a view that is not index.
Lowell
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply