Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 row exceeds the maximum

Author  Topic 

young555
Starting Member

9 Posts

Posted - 2009-04-25 : 16:11:43
I’m creating a query which is pulling together fields from different tables.When I run the query it throws some errors for some of the fields in the table saying:
The table '@mytable' has been created but its maximum row size (12356) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.

I have tried to use different data types such as char and change the number the data type is being speicifed to e.g. @field nvarchar (50). i have also tried to use nvarchar(max) but it says Msg 170, Level 15, State 1, Line 14Line 14: Incorrect syntax near 'max' for some reason.

is there any way I can overcome this?

thank you


declare @field1 int
declare @field2 nvarchar (50)
declare @field3 nvarchar (200)
declare @field4 nvarchar (50)
declare @field5 datetime
declare @field6 nvarchar (1000)
declare @field7 datetime
declare @field8 int
declare @field9 nvarchar (50)
declare @field10 nvarchar (3999)
declare @field11 nvarchar (3999)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-25 : 16:46:23
NVARCHAR(MAX) require you to set the compatibility level to 90 or higher.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

young555
Starting Member

9 Posts

Posted - 2009-04-26 : 03:36:23
thanks for you reply.
im new to sql server, can you please tell me how i can change the compatability level to 90?

thank you
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-26 : 03:40:33
http://www.lmgtfy.com/?q=change+compatibility+level+for+sql+server+2005


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

young555
Starting Member

9 Posts

Posted - 2009-04-27 : 15:09:57
thanks, i decided to go with soemthing else now because it was giving me to much trouble using this
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-27 : 15:14:27
Ok.
Good luck.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -