SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


FAQ Topics

All FAQ's
General DBA
General Developer
DBA Performance Tuning
Developer Performance Tuning
Clustering
Error Messages

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Working with Windows Communication Foundation (WCF)
Transfer Logins Task and Transfer Database Task in SSIS
Practical Database Change Management (Part 2)
Practical Database Change Management (Part 1)

More     
 
Latest FAQ's

ALTER TABLE SWITCH statement failed because column '%.*ls' has data type ...
ALTER TABLE SWITCH statement failed because column '%.*ls' has data type ...
ALTER TABLE SWITCH statement failed. There is no identical index in ...
'%ls' statement failed because the expression identifying partition number for the ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008
ApexSQL Enforce

More     

Cannot create %S_MSG on view "%.*ls". The view contains a self join on "%.*ls".



Error Message:
Msg 1947, Level 16, State 1, Line 2
Cannot create %S_MSG on view "%.*ls". The view contains a self join on "%.*ls".

Severity level:
16.

Description:
This error message appears when you try to create an indexed view that contains a self-join.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity Level 16 are generated by the user and are corrigible by the user. The statement cannot be executed this way. The self-join must be removed.

Versions:
All versions of SQL Server.

Example(s):
USE Northwind;
GO
SET NUMERIC_ROUNDABORT OFF;
SET ANSI_PADDING,
    ANSI_WARNINGS,
    CONCAT_NULL_YIELDS_NULL,
    ARITHABORT,
    QUOTED_IDENTIFIER,
    ANSI_NULLS ON;
GO

IF OBJECT_ID ('dbo.MyOrderView', 'View') > 0
   DROP VIEW dbo.MyOrderView;
GO
CREATE VIEW dbo.MyOrderView
WITH SCHEMABINDING
AS
SELECT SUM(od.UnitPrice*od.Quantity*(1.00-od.Discount)) AS Revenue,
    o.OrderDate, od.ProductID, COUNT_BIG(*) AS MyCount
  FROM dbo.[Order Details] AS od
  JOIN dbo.Orders AS o
    ON od.OrderID = o.OrderID
    JOIN dbo.Orders t1
      ON o.OrderID = t1.OrderID
 GROUP BY o.OrderDate, od.ProductID;
GO

CREATE UNIQUE CLUSTERED INDEX cix_MyOrderView
    ON dbo.MyOrderView (OrderDate, ProductID);
GO

Remarks:
In the above example we try to index the view MyOrderView. Because this view contains a self-join on the table Orders, the error is raised.








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved