Posts Tagged ‘views’

View or function ‘dbo.Viewname’ has more column names specified than columns defined

If you ever encounter this SQL Server error when selecting from a view then somebody has probably dropped columns from the base table. Here’s a quick run through of the problem. ?View Code TSQLCREATE TABLE dbo.Contact ( Id INTEGER IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED, FirstName VARCHAR(50) NOT NULL, LastName VARCHAR(50) NOT NULL, DOB DATETIME […]

Views or functions cannot reference themselves directly or indirectly

Today I received the following SQL Server error which I had never encountered before. Msg 4429, Level 16, State 1, Line 1 View or function ‘Table_1’ contains a self-reference. Views or functions cannot reference themselves directly or indirectly. Msg 4413, Level 16, State 1, Line 1 Could not use view or function ‘Test.Table_1’ because of […]