<%conn.execute "update A表 set 数量=A表.数量- B表.销售数量 from A表 inner join B表 on A表.编号=B表.编号 where A表.编号=1001"%>
用的是这个nvarchar数据类型 怎么样进行转换啊?
没转换报错
[Microsoft][ODBC SQL Server Driver][SQL Server]对数据类型而言运算符无效。运算符为 subtract,类型为 nvarchar。
A表数据表类型:if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[kucun]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[kucun]
GO
CREATE TABLE [dbo].[kucun] (
[编号] [int] NULL ,
[品种] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[数量] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
B表数据表类型:if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[xiaoshoubiao]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[xiaoshoubiao]
GO
CREATE TABLE [dbo].[xiaoshoubiao] (
[编号] [int] NULL ,
[品种] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[销售数量] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[销售单价] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[销售总价] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[销售时间] [datetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO