-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Written by Kimberly L. Tripp, SQLskills.com
-- All Rights Reserved.
-- 
-- For more scripts, sample code and additional training resources,
-- go to http://www.SQLskills.com
--	Immerse yourself in SQL Server
--
-- Disclaimer - Thoroughly test this script, execute at your own risk.
-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-- Test script... doesn't work...well, that was the point of the test :).
CREATE VIEW dbo.test
	WITH SCHEMABINDING
AS 
SELECT member_no, lastname, firstname
FROM dbo.member
go
CREATE VIEW dbo.test2
	WITH SCHEMABINDING
AS
SELECT member_no, lastname
FROM dbo.test
go
CREATE UNIQUE CLUSTERED INDEX testindex ON dbo.test2 (member_no)
go
-- Error
-- Server: Msg 1937, Level 16, State 1, Line 1
-- Cannot index the view 'Credit.dbo.test2'. It references another 
-- view or function 'dbo.test'.
