Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 schemabinding

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-07-04 : 04:16:57
Is it possible to create one view with schemabinding which has the select query on several tables?
Or do I have to have one view with schemabinding per table?
Thanks

i.e.

alter view vwTables with schemabinding
as
SELECT ActionID, [Action] FROM dbo.tblActions
SELECT AuditID,TableID,ActionID,UserID,ActionDate FROM dbo.tblAudits

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-07-04 : 04:29:42
What does Books Online tell you?
quote:
Schema-bound Functions
CREATE FUNCTION supports a SCHEMABINDING clause that binds the function to the schema of any objects it references, such as tables, views, and other user-defined functions. An attempt to alter or drop any object referenced by a schema-bound function fails.

These conditions must be met before you can specify SCHEMABINDING in CREATE FUNCTION:

All views and user-defined functions referenced by the function must be schema-bound.


All objects referenced by the function must be in the same database as the function. The objects must be referenced using either one-part or two-part names.


You must have REFERENCES permission on all objects (tables, views, and user-defined functions) referenced in the function.


You can use ALTER FUNCTION to remove the schema binding. The ALTER FUNCTION statement should redefine the function without specifying WITH SCHEMABINDING.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2007-07-04 : 04:35:52
Apologiese but I do not follow you.
Please elaborate.
Go to Top of Page

sathiya
Starting Member

4 Posts

Posted - 2007-07-04 : 05:14:17
1.U can have one or more schema binding view for same table
2.We can create views with multiple tables with schema binding
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-04 : 07:30:50
http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_thread/thread/520a22fc55bb8fdc/dd675d710e1205d8#dd675d710e1205d8

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

pootle_flump

1064 Posts

Posted - 2007-07-04 : 07:43:42
quote:
Originally posted by sathiya

2.We can create views with multiple tables with schema binding


But not as arkiboys has it. The schemabinding is irrelevent - you can't define a view like that period.
Go to Top of Page

pootle_flump

1064 Posts

Posted - 2007-07-04 : 07:45:33
quote:
Originally posted by arkiboys

Apologiese but I do not follow you.
Please elaborate.


Peter's point was why not look it up for yourself in the manual? Having said that it does look like he copied & pasted the wrong section although it all looks relevent to views from here.
Go to Top of Page
   

- Advertisement -