What database field type should I use to store web pages (html, pdf, text) files in the same field? nvarchar(max)?
我应该使用什么数据库字段类型来存储同一字段中的网页(html,pdf,text)文件?为nvarchar(最大)?
3 个解决方案
#1
1
You'd want to use VARBINARY(MAX)
or NVARCHAR(MAX)
, depending on the type of data being stored and what you want to do with it. If you going to store files (which it sounds like, especially with mixed extensions), use VARBINARY(MAX)
. You can full-text index off that data type too -- although PDF's require an additional iFilter (at least it did with our SQL Server 2005 instance -- it may be there by default in 2008).
您需要使用VARBINARY(MAX)或NVARCHAR(MAX),具体取决于要存储的数据类型以及您要对其执行的操作。如果你要存储文件(听起来像,特别是混合扩展名),请使用VARBINARY(MAX)。您也可以对该数据类型进行全文索引 - 尽管PDF需要额外的iFilter(至少它与我们的SQL Server 2005实例一样 - 它可能在2008年默认存在)。
Keep in mind that you don't want to use IMAGE, as that data type (along with TEXT and NTEXT) is deprecated and is being removed in a future version of SQL Server. Here's the link about that.
请记住,您不想使用IMAGE,因为该数据类型(以及TEXT和NTEXT)已弃用,并且将在SQL Server的未来版本中删除。这是关于它的链接。
Hope this helps.
希望这可以帮助。
#2
2
Use VARBINARY(MAX)
. NVARCHAR
is only for Unicode content, which won't handle PDFs well at all.
使用VARBINARY(MAX)。 NVARCHAR仅适用于Unicode内容,它根本无法处理PDF。
#3
1
VARBINARY(MAX). If you're using SQL Server 2008, then FILESTREAM is also an option that should be considered. According to Microsoft's guidelines, consider FILESTREAM when:
VARBINARY(MAX)。如果您使用的是SQL Server 2008,那么FILESTREAM也是一个应该考虑的选项。根据Microsoft的指南,在以下情况下考虑FILESTREAM:
- Objects that are being stored are, on average, larger than 1 MB.
- Fast read access is important.
- You are developing applications that use a middle tier for application
logic.
存储的对象平均大于1 MB。
快速读取访问很重要。
您正在开发使用中间层应用程序逻辑的应用程序。
#1
1
You'd want to use VARBINARY(MAX)
or NVARCHAR(MAX)
, depending on the type of data being stored and what you want to do with it. If you going to store files (which it sounds like, especially with mixed extensions), use VARBINARY(MAX)
. You can full-text index off that data type too -- although PDF's require an additional iFilter (at least it did with our SQL Server 2005 instance -- it may be there by default in 2008).
您需要使用VARBINARY(MAX)或NVARCHAR(MAX),具体取决于要存储的数据类型以及您要对其执行的操作。如果你要存储文件(听起来像,特别是混合扩展名),请使用VARBINARY(MAX)。您也可以对该数据类型进行全文索引 - 尽管PDF需要额外的iFilter(至少它与我们的SQL Server 2005实例一样 - 它可能在2008年默认存在)。
Keep in mind that you don't want to use IMAGE, as that data type (along with TEXT and NTEXT) is deprecated and is being removed in a future version of SQL Server. Here's the link about that.
请记住,您不想使用IMAGE,因为该数据类型(以及TEXT和NTEXT)已弃用,并且将在SQL Server的未来版本中删除。这是关于它的链接。
Hope this helps.
希望这可以帮助。
#2
2
Use VARBINARY(MAX)
. NVARCHAR
is only for Unicode content, which won't handle PDFs well at all.
使用VARBINARY(MAX)。 NVARCHAR仅适用于Unicode内容,它根本无法处理PDF。
#3
1
VARBINARY(MAX). If you're using SQL Server 2008, then FILESTREAM is also an option that should be considered. According to Microsoft's guidelines, consider FILESTREAM when:
VARBINARY(MAX)。如果您使用的是SQL Server 2008,那么FILESTREAM也是一个应该考虑的选项。根据Microsoft的指南,在以下情况下考虑FILESTREAM:
- Objects that are being stored are, on average, larger than 1 MB.
- Fast read access is important.
- You are developing applications that use a middle tier for application
logic.
存储的对象平均大于1 MB。
快速读取访问很重要。
您正在开发使用中间层应用程序逻辑的应用程序。