an ASP.NET Open Source CMS & eCommerce platform
Search:
Last Post 11/11/2008 11:09:20 AM By Newmedia Design. 4 replies.
11/11/2008 9:12:22 AM
Newmedia Design
Posts: 65
Joined: 9/25/2008
vw_DSC_Category_Count
Hi Lukezy
 
I changed the sixe of the descrition filed in the category table from 500 to 1000 but now I am getting the following error.
Is there anything I can do to fix this? I have a local copy of the database. is it possible to recreate this view witrh indexes etc?
 

Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.
Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.
Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.
Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.
Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.
Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.
Hint 'noexpand' on object 'vw_DSC_Category_Count' is invalid.

Source Error:

<table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td>
Line 75:     private void InitializeCategoryTreeView() {
Line 76:         tvwCategory.Nodes.Clear();
Line 77:         Category[] categories = Category.GetCategories();
Line 78:         foreach (Category c in categories) {
Line 79:             AddCategoryToTreeNode(tvwCategory.Nodes, c);
</td> </tr> </tbody> </table>
Source File: d:\domains\development.ie\wwwroot\Admin\Catalog\Categories.aspx.cs    Line: 77
11/11/2008 10:19:19 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: vw_DSC_Category_Count
How did you change the size of the description field? Did you use the SQL script or management studio UI?
 
I guess you touched the indexed view 'vw_DSC_Category_Count'  somehow. If you have the database backup, try restoring it to the state before your change. And then use SQL script to change the field size.
DotShoppingCart Staff
11/11/2008 10:47:59 AM
Newmedia Design
Posts: 65
Joined: 9/25/2008
Re: vw_DSC_Category_Count
Hi Lukezy
 
I used the management tool(unfortunately), My backup is 3days old so I will lose alot of data if I restore. Is there anyway I can recreate the viewed index ''vw_DSC_Category_Count'  from my backup? Any sugestions at all would be greatly appreciated as this will set me back days.
 
Thanks
 
 
11/11/2008 10:59:37 AM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: vw_DSC_Category_Count
Ok, try dropping the view and then create the view by using the following SQL. BTW, try backing up the database as often as possible
 
CREATE VIEW [dbo].[vw_DSC_Category_Count] WITH SCHEMABINDING
AS
SELECT     dbo.DSC_Category.categoryId, SUM(dbo.DSC_Category_Manufacturer_Count.count) AS count, COUNT_BIG(*) AS recordCount
FROM         dbo.DSC_Category INNER JOIN
                      dbo.DSC_Category_Manufacturer_Count ON dbo.DSC_Category.categoryId = dbo.DSC_Category_Manufacturer_Count.categoryId
GROUP BY dbo.DSC_Category.categoryId
 
CREATE UNIQUE CLUSTERED INDEX [IK_vw_DSC_Category_Count] ON [dbo].[vw_DSC_Category_Count] ([categoryId]) WITH (STATISTICS_NORECOMPUTE=ON) ON [PRIMARY]
 
DotShoppingCart Staff
11/11/2008 11:09:20 AM
Newmedia Design
Posts: 65
Joined: 9/25/2008
Re: vw_DSC_Category_Count
Brilliant Lukezy that worked and i used this query to alter the description nvarchar size and it worked.
 
Thanks again 

 

<font color="#0000ff" size="2"><font color="#0000ff" size="2">

ALTER

 

<font color="#0000ff" size="2"><font color="#0000ff" size="2">TABLE [dbo]<font color="#808080" size="2"><font color="#808080" size="2">.[dsc_category]<font color="#0000ff" size="2"><font color="#0000ff" size="2">ALTER <font color="#0000ff" size="2"><font color="#0000ff" size="2">COLUMN description <font color="#0000ff" size="2"><font color="#0000ff" size="2">nvarchar<font color="#808080" size="2"><font color="#808080" size="2">(2000<font color="#808080" size="2"><font color="#808080" size="2">) <font color="#808080" size="2"><font color="#808080" size="2">NULL