1

I try to import sql script, generated with Server Management Studio, into SQL Compact 3.5 and get a lot of error. What I am doing wrong?

I generate script with "Task/Generate Script" context menu. Part of my script:

CREATE TABLE [LogMagazines](
[IdUser] [int] NOT NULL,
   [Text] [nvarchar](500) NULL,
[TypeLog] [int] NOT NULL,
[DateAndTime] [datetime] NOT NULL,
[DetailMessage] [nvarchar](max) NULL,
[Id] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_LogMagazines] PRIMARY KEY
(
[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]

Knowledge Base:

1 Answer 1

4

SQL Server Compact 3.5 does not support the full SQL Server (non-Compact) DLL/feature set. E.g. nvarchar(max) is not supported, nor is the ON PRIMARY syntax, since the compact database is stored in a single file.

Ref. SQL Server Compact Edition CREATE TABLE: link text

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. Do you know any possible way to convert DB from SQL Server to SQL Server Compact? Or maybe some set of rules to do this manually?
Generally, it's not possible to convert an SQL Server DB to an SQL Server Compact DB, because of the differences in features. If you want to convert/replicate simple tables with data, you could possibly use the SqlCe 3.5 replication feature, that could take care of the type mapping and table creation for you, depending on your source DB of course. Note that there are a number of different options when it comes to SqlCe synchronization with other data sources: technet.microsoft.com/en-us/library/ms171801.aspx

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.