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)
 Varchar(max)......

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-04-18 : 09:33:33
Hi I have a ntext field which i want to convert to varchar(max)

but get the following error:

alter table Table_test
alter column Column_1 varchar(max)

Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near 'max'.

Any ideas why i get this error?

I am using SQL Server 2005

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-18 : 09:52:10
Check the compatibility mode for your database:

EXEC sp_dbcmptlevel 'db-name'

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-04-18 : 09:56:31
its says:

The current compatibility level is 80.

That is the latest level? why doesn't it work...?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-18 : 10:02:39
No. That means your compatibility level is set to that of SQL Server 2000.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-04-18 : 10:03:42
oh I see, how can I change this?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-18 : 10:26:50
[code]EXEC sp_dbcmptlevel 'db-name', 90[/code]

But before doing this, investigate about why it was set to SQL Server 2000 compatibility mode in the first place.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-19 : 04:03:15
Changing compatibility level from SQL-2000 to SQL-2005 should involve a complete set of QA tests. There may be subtle differences between the two.

If you have upgraded a SQL 2000 database to SQL 2005 (or restored a SQL 2000 backup onto a SQL 2005 server) then that database will be in SQL-2000 compatibility mode, until you change it!

Kristen
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2007-04-19 : 05:06:57
It doesn't let me change the compatibility. I believe it may be due to the fact that I only have desktop edition?

print @@Version:

Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 2)

Which Version of SQL Server should I install on my laptop to ensure I have 2005 compatibility, I cannot install Enterprise as my Operating System is: Windows XP Professional Edition 2002 Service Pack 2
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-04-19 : 07:13:14
"Microsoft SQL Server 2000"

You are nto using SQL 2005; varchar(max) was not available until SQL 2005.

Kristen
Go to Top of Page
   

- Advertisement -