Invalid varbinary (max) data type

CREATE TABLE Uploads
(
    id          uniqueidentifier NOT NULL PRIMARY KEY,
    DI_Id       INT              NOT NULL,
    FileData    VARBINARY(Max)   NULL,
    sFileName   nvarchar(50)     NOT NULL,
    ContentType nvarchar(50)     NOT NULL
)

I tried to create a table as above.

Error on error varbinary(max).

If I specify a fixed column size, for example varbinary(100), then no error occurs.

How can I declare varbinary(max)in SQL Server 2005?

+5
source share
1 answer

SQL Server 2005 supports VARBINARY(MAX) .

Either you execute this CREATE TABLE statement on a SQL Server 2000 machine, or your database is still at compatibility level = 80 (SQL Server 2000).

Check your compatibility level with this query:

SELECT name, compatibility_level
FROM master.sys.databases
WHERE name = 'yourdatabase'

If you get an error while executing this query, you are working with SQL Server 2000 :-)

80, 90 (SQL Server 2005):

ALTER DATABASE YourDatabase SET COMPATIBILITY_LEVEL = 90
+6

All Articles