USE [DatabaseName]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TableName](
[ID] [int] IDENTITY(1,1) NOT NULL,
[URL] [varchar](max) NOT NULL,
[User] [varchar](1000) NOT NULL,
[Time] [datetime] NOT NULL,
CONSTRAINT [PK_TableName] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
it works on development environment which is SQL Server 2005 but doesn’t work on SQL Server 2012 and gives this error,
Msg 170, Level 15, State 1, Line 3 Line 3: Incorrect syntax near
‘max’.
EDIT
2012 is actually 2000 but Network admin did something so that I can connect to it using 2012 management tool studio
The reason for this error is when user is tring to attempt to run query or procedure or logic which is not compatible with previous version of the SQL Server. When SQL Server 2000 is upgraded to SQL Server 2005 or SQL Server 2008, the database object compatibility should be also upgraded to next version. When database compatibility is set to previous version and they are attempted with procedure of newer version they will throw above error.
Fix/Workaround/Solution:
Change the database compatibility level using following command.