Sureshbabu Sankarasubbu
SSC Enthusiast
Points: 162
More actions
August 22, 2005 at 10:27 am
#76403
Hi,
What is Max no of Columns that a table can have in sql server ?
Thanks in advance.
-Suresh
Merrill Aldrich
SSCrazy
Points: 2358
August 22, 2005 at 11:58 am
#583997
The max is somewhere around 254, I think. If you even approach that, it seems like it might indicate a problem with your design, though...
Ninja's_RGR'us
SSC Guru
Points: 294069
August 22, 2005 at 12:09 pm
#584000
It's 1024 :
CREATE TABLE test
( [1] int not null
)
DECLARE @I as int
DECLARE @Exec as varchar(8000)
PRINT '1'
set @I = 2
while @I < 3000
begin
SET @Exec = 'ALTER TABLE test ADD [' + CAST(@I AS VARCHAR(5)) + '] int null'
EXEC (@Exec)
IF @@ERROR 0
SET @I = 99999
ELSE
BEGIN
PRINT @I
set @I = @I + 1
END
end
DROP TABLE test
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply