SQL Server Compact 有哪些限制?(或者 - 如何选择在 MS 平台上使用的数据库?)
我想使用 MS Visual C# Express 构建的应用程序(如果需要,我愿意升级到标准版)需要一个数据库.
The application I want to build using MS Visual C# Express (I'm willing to upgrade to Standard if that becomes required) that needs a database.
我对 SQL Server Compact 非常着迷 - 因为我不希望将我的应用程序安装在他们的计算机上的人必须安装整个 SQL Server 或类似的东西.我希望最终用户安装起来尽可能简单.
I was all psyched about the SQL Server Compact - because I don't want the folks who would be installing my application on their computers to have to install the whole of SQL Server or something like that. I want this to be as easy as possible for the end user to install.
所以我很兴奋,直到我可以对表格中的列执行的操作似乎受到限制.我创建了一个新数据库,创建了一个表,当我去创建列时,似乎没有文本"数据类型——只是一种叫做ntext"的东西,它似乎被限制为 255 个字符.int"似乎仅限于 4 个(我想要 11 个).而且似乎没有auto_increment"功能.
So I was all psyched until it seems that there are limitations to what I can do with the columns in my tables. I created a new database, created a table and when I went to create columns it seems that there isn't a "text" datatype - just something called "ntext" that seems to be limited to 255 characters. "int" seems to be limited to 4 (I wanted 11). And there doesn't seem to be an "auto_increment" feature.
这些是我必须忍受的真正限制吗?(或者是因为我使用的是Express"而不是Standard").如果这些是真正的限制,那么满足我的要求的其他数据库选项是什么?(用户很容易安装 - 我假设我的最终用户只是计算机的普通用户,如果它很复杂,我的应用程序会感到沮丧)
Are these the real limitations I would have to live with? (Or is it because I'm using "Express" and not "Standard"). If these are the real limitations, what are my other database options that meet my requirements? (easy installation for user being the biggie - I'm assuming that my end user is just an average user of computers and if it's complicated would get frustrated with my application)
-阿迪娜
PS:我还希望对最终用户加密我的数据库数据.我不希望他们能够直接访问数据库表.
PS: I also want my database data to be encrypted to the end user. I don't want them to be able to access the database tables directly.
PPS.我确实读过:http://www.microsoft.com/Sqlserver/2005/en/us/compact.aspx 并且没有看到关于这些特定限制的讨论
PPS. I did read: http://www.microsoft.com/Sqlserver/2005/en/us/compact.aspx and didn't see a discussion on these particular limitations
推荐答案
我不确定加密,但您可能会发现此链接很有帮助:
http://msdn.microsoft.com/en-us/library/ms171955.aspx
I'm not sure about encryption, but you'll probably find this link helpful:
http://msdn.microsoft.com/en-us/library/ms171955.aspx
至于其余部分:
Text"和auto_increment"让我想起了 Access.SQL Server Compact 应该升级兼容 SQL Server 的服务器 版本,因为在紧凑型数据库中使用的查询和表应该无需修改即可转移到完整数据库.考虑到这一点,您应该首先查看 SQL Server 类型和名称 而不是访问名称:在本例中为 varchar(max)
、bigint
和 identity
列.
As for the rest of it:
"Text" and "auto_increment" remind me of Access. SQL Server Compact is supposed to be upgrade compatible to the server editions of SQL Server, in that queries and tables used in your compact database should transfer to a full database without modification. With that in mind, you should first look at the SQL Server types and names rather than Access names: in this case namely varchar(max)
, bigint
, and identity
columns.
不幸的是,您会注意到这在 varchar(max) 方面失败了,因为 Compact Edition 还没有 varchar(max) 类型.希望他们能尽快解决这个问题.但是,您正在查看的 ntext 类型支持的字节数远不止 255 个:实际上是 230,相当于超过 5 亿个字符.
Unfortunately, you'll notice this fails with respect to varchar(max), because Compact Edition doesn't yet have the varchar(max) type. Hopefully they'll fix that soon. However, the ntext type you were looking at supports many more than 255 bytes: 230 in fact, which amounts to more than 500 million characters.
最后,bigint 使用 8 个字节进行存储.您要求 11.但是,我认为您在这里可能会混淆存储大小表示可用的十进制位数.这绝对不是这种情况.8 字节的存储空间允许最多 264 的值,这将容纳 11 位以上的数字.如果您有那么多项目,无论如何您可能都需要一个服务器级数据库.如果您真的想从数字的角度思考,还提供了 numeric
类型.
Finally, bigint uses 8 bytes for storage. You asked for 11. However, I think you may be confused here that the storage size indicates the number of decimal digits available. This is definitely NOT the case. 8 bytes of storage allows for values up to 264, which will accomodate many more than 11 digits. If you have that many items you probably want a server-class database anyway. If you really want to think in terms of digits, there is a numeric
type provided as well.
相关文章