February 4, 2004 at 4:25 pm
Why does this not work? I'm using SQL2K, and have done everything BOL says is required, but I keep getting this error.
Server: Msg 1939, Level 16, State 1, Line 1
Cannot create index on view 'TestView1' because the view is not schema bound.
------------------------------------------------
if object_ID('TestTable1', 'U') is not null drop table TestTable1
go
create table TestTable1 (TTid int identity Not Null)
go
if object_ID('TestView1', 'V') is not null drop view TestView1
go
create view TestView1
as
select TTid from dbo.TestTable1
schemabinding
go
create unique clustered index CI_TestView1_TTid on TestView1 (TTid)
Signature is NULL
February 4, 2004 at 5:23 pm
try...
create view TestView1 with schemabinding as
select TTid from dbo.TestTable1
in the code you posted, it appears that you are aliasing TestTable1 as the alias name "schemabinding"
HTH
Biilly
February 4, 2004 at 7:03 pm
Ah! That's the ticket, Billy; thank you very much. It wasn't showing up as a syntax error because of aliasing, which totally threw me off.
"with schemabinding"....that works like a charm. Personally, I've always avoided views due to performance problems, but I'm being forced to use them by circumstances outside of my control.
Thanks again.
cl
Signature is NULL
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply