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 ]

2
  • If it is a CE release, use nvarchar instead of varchar. Oct 6, 2015 at 4:03
  • Yeah. nchar works. Thanks Oct 6, 2015 at 4:10

2 Answers 2

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

2
  • @IhsanIzwer Glad this worked.. Accept the answer pls. Oct 6, 2015 at 4:07
  • Ah i see, you are using SQL Server Compact.
    – japzdivino
    Oct 6, 2015 at 4:08
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

4
  • that's the problem. It works in college, VArRCHAR and CHAR. but not here. Oct 6, 2015 at 4:03
  • @IhsanIzwer , you are using SQL Server 2008 right ? , that seems working on mine.. sqlfiddle sample in my answer above, are you sure you are working in SQL Server 2008 ?
    – japzdivino
    Oct 6, 2015 at 4:07
  • @JapzDivino compact has this problem. Varchar is not supported there. Oct 6, 2015 at 4:10
  • @AmneshGoel , Ah i see. Thanks
    – japzdivino
    Oct 6, 2015 at 4:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.