Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2007, 10:53 AM
Registered User
 
Join Date: May 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating Index on View - SQL

Hi,

I am trying to create in dexes on view but it need to bound with Schema bound (which is false on view).
Colud you please advise
a) how can I change Schema bound to True (if we can do by GUI)
b) Or we can create index without that

thaks


AA
 
Old May 23rd, 2007, 11:43 AM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

a. To make your schema bound, in Enterprise Manager right-click on your view and select "Design View". Right-click on the window again and select Properties from the context menu. Then put a check mark in the "Bind to Schema" option.

b. You cannot create an indexed view without schema binding.

SQL Server Helper
How well do you know SQL? Find out with the free test assessment from SQL Server Helper!!!
http://www.sql-server-helper.com/free-test/default.aspx

Got a SQL Server Question? Ask us here: http://www.sql-server-helper.com/forums/default.asp
 
Old May 23rd, 2007, 12:02 PM
Registered User
 
Join Date: May 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using SQL 2005 :

On my view I did right-click but I don't see "Design View" but there is anotner option "New View" should I select this?

I am not sure if I am doing something wrong??
Thanks


AA
 
Old May 24th, 2007, 01:44 AM
Authorized User
 
Join Date: Jun 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default

Right click on the view and Script View as Alter to a new query window. then add this line of code

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[VW_ViewName] with schemabinding
AS

Make sure SET QUOTED_IDENTIFIER is ON


"Dont you ever give up!"
 
Old May 24th, 2007, 06:53 AM
Registered User
 
Join Date: May 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for advise - it worked :)

AA
 
Old September 7th, 2011, 07:35 AM
Registered User
 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I couldn't understand properly. My view code is as shown below:

Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[B2]
AS
 
"SQL QUERY"

GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
Shall I only change "ALTER VIEW [dbo].[B2]" section with "ALTER VIEW [dbo].[B2] with schemabinding"??


Many thanks
telmessos





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Index carumuga SQL Server 2000 1 September 26th, 2008 04:10 PM
Cannot index the view '. It contains one or more d RehanHussain SQL Server 2000 2 April 12th, 2008 03:57 PM
SQL view creating Cute Designer SQL Server ASP 1 September 21st, 2005 03:00 PM
Index View Asish SQL Server 2000 1 November 7th, 2003 01:12 PM
View dynamic content with MS Index Server? shogunmike Classic ASP Basics 0 June 26th, 2003 12:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.