views:

255

answers:

1

More of a curious question I can't seem to quickly find an definite answer to.

In SQL Server 2008 is there a max limitation on the number of columns that are allowed in a view? From the MSDN article (below) I see that there is a limit of 4096 Columns per Select statement. Would this then be applied to a View?

Example:

CREATE VIEW [dbo].[TestView]
AS
SELECT     Column1, Column2 FROM dbo.SomeTableName

Would I be limited to 4096 columns in this view?

http://msdn.microsoft.com/en-us/library/ms143432.aspx

+3  A: 

By default of finding an authoritative source, I figured I'd try...

It appears that the limit is 1024 columns, that is the case in SQLServer 9.0 (both 'Express' and Enterprise versions).

    The error message is:
    Msg 4505, Level 16, State 1, Procedure wvTest, Line 3
    CREATE VIEW failed because column 'Yo1' in view 'vwTest'
                       exceeds the maximum of 1024 columns.
mjv
Upvote for creating a view with more than 1024 columns :)
bogertron
@bogertron Thanks that was hours of tedious editing!... (luckily I scripted the making of such a monster ;-) )
mjv
mjv, v9 is 2005. Do you have access to SQL 2008 to do the same test?
Paul Prewett

related questions