Search code examples
sqlsql-server-2008sql-server-ce

SQL Server 2008 varchar and char not working


I get an error saying varchar or char is not a recognized in SQL Server. However I use the same software, SQL Server 2008 in college, so I do not want to go for a different version of SQL Server. Anyway I can fix this?

Major Error 0x80040E14, Minor Error 26302

create table abc 
(
    id int,
    name  varchar(15)
)

Error is:

The specified data type is not valid. [ Data type (if known) = varchar ]


Solution

  • varchar(n) is not supported in SQL Server Compact. Here is the full list of types supported.

    Following are the types that you can use.

    nvarchar(n)
    nchar(n)
    ntext
    

    So you might need to change to nvarchar(10), nvarchar(5) and nchar(1) etc..