-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- Written by Kimberly L. Tripp - all rights reserved.
-- 
-- For more scripts and sample code, check out 
-- 	http://www.SQLSkills.com
-- For "More than Just Training," see the Industry Experts at 
-- 	http://www.SolidQualityLearning.com
--
-- 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'.
