找不到数据类型blob

时间:2017-07-27 14:12:27

标签: sql sql-server database image

我试图创建一个图像数据库,到目前为止我从互联网上得到了这个:

CREATE TABLE testblob (
image_id tinyint not null default '0',
image_type varchar(25) not null default '',
image blob not null,
image_size varchar(25) not null default '',
image_ctgy varchar(25) not null default '',
image_name varchar(50) not null default '', 
);

我收到了这个错误:

  

Msg 2715,Level 16,State 6,Line 1   列,参数或变量#3:找不到数据类型blob

1 个答案:

答案 0 :(得分:0)

试试这个

/****** Object:  Table [dbo].[testblob]    Script Date: 7/27/2017 7:53:08 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[testblob](
    [image_id] [tinyint] NOT NULL,
    [image_type] [varchar](25) NOT NULL,
    [image] [varbinary](max) NOT NULL,
    [image_size] [varchar](25) NOT NULL,
    [image_ctgy] [varchar](25) NOT NULL,
    [image_name] [varchar](50) NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[testblob] ADD  DEFAULT ('0') FOR [image_id]
GO

ALTER TABLE [dbo].[testblob] ADD  DEFAULT ('') FOR [image_type]
GO

ALTER TABLE [dbo].[testblob] ADD  DEFAULT ('') FOR [image_size]
GO

ALTER TABLE [dbo].[testblob] ADD  DEFAULT ('') FOR [image_ctgy]
GO

ALTER TABLE [dbo].[testblob] ADD  DEFAULT ('') FOR [image_name]
GO