SQL Server 2008 varchar and char not working

0

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 ]

sql
sql-server-2008
sql-server-ce
asked on Stack Overflow Oct 6, 2015 by Ihsan Izwer • edited Oct 6, 2015 by Ajay2707

2 Answers

3

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..

answered on Stack Overflow Oct 6, 2015 by Amnesh Goel • edited Oct 6, 2015 by Amnesh Goel
0

Really ? , i tried it, also i tried in creating temp table, it seems both are ok.

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

    create table #tmp (id int, name varchar(15))

http://sqlfiddle.com/#!3/66b44

answered on Stack Overflow Oct 6, 2015 by japzdivino

User contributions licensed under CC BY-SA 3.0