views:

460

answers:

1

Hi! 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:

+3  A: 

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

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?
Sasha
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: http://technet.microsoft.com/en-us/library/ms171801.aspx