遇到一个sql2000的问题,实在搞不懂了,求解决的办法?
2008-12-16 11:56
716 查看
我的SQl语句,其实很简单的,但是就是错误,没办法了!
Code
if exists (select top 1 * from sysobjects where name ='HMonthOtherTotal' and xtype = 'U')
drop table HMonthOtherTotal
Go
Create table HMonthOtherTotal
(
PKID int primary key identity(1,1),
UnitID int,
YearMonth nvarchar(12),
Type1 int default 0,
Type2 int default 0,
Type3 int default 0,
Type4 int default 0
--constraint MonthID unique (YearMonth)
)
Go
if exists (select * from sysobjects where xtype ='p' and name ='HMonthOtherTotal_Insert' )
Drop procedure HMonthOtherTotal_Insert
Go
create procedure HMonthOtherTotal_Insert
(
@PKID int output,
@UnitID int,
@YearMonth nvarchar(12),
@Type1 int,--制止行人、非机动车违章上路(人 辆/次):
@Type2 int,--纠正车辆违章(辆/次):
@Type3 int,--施工安全管理(处/起):
@Type4 int --其它:
)
As
/*Insert into HMonthOtherTotal (UnitID,YearMonth,Type1,Type2,Type3,Type4)
values (@UnitID,@YearMonth,@Type1,@Type2,@Type3,@Type4)
*/
Insert into HMonthOtherTotal(UnitID,YearMonth,Type1,Type2,Type3,Type4)
values (@UnitID,@YearMonth,@Type1,@Type2,@Type3,@Type4)
SET @PKID=SCOPE_IDENTITY();
return
Go
Insert into HMonthOtherTotal(UnitID,YearMonth,Type1,Type2,Type3,Type4)
values (2,'2008年10月',20,120,120,14)
execute HMonthOtherTotal_Insert 2,'2008年12月',20,120,120,14
最后两句是我插入数据的那种犯法,第一种直接插入是可以添加数据的,
但是第二种就不行了,报告错误:
服务器: 消息 8114,级别 16,状态 4,过程 HMonthOtherTotal_Insert,行 0
将数据类型 varchar 转换为 int 时出错。
快点解决啊,就要交项目了。
Code
if exists (select top 1 * from sysobjects where name ='HMonthOtherTotal' and xtype = 'U')
drop table HMonthOtherTotal
Go
Create table HMonthOtherTotal
(
PKID int primary key identity(1,1),
UnitID int,
YearMonth nvarchar(12),
Type1 int default 0,
Type2 int default 0,
Type3 int default 0,
Type4 int default 0
--constraint MonthID unique (YearMonth)
)
Go
if exists (select * from sysobjects where xtype ='p' and name ='HMonthOtherTotal_Insert' )
Drop procedure HMonthOtherTotal_Insert
Go
create procedure HMonthOtherTotal_Insert
(
@PKID int output,
@UnitID int,
@YearMonth nvarchar(12),
@Type1 int,--制止行人、非机动车违章上路(人 辆/次):
@Type2 int,--纠正车辆违章(辆/次):
@Type3 int,--施工安全管理(处/起):
@Type4 int --其它:
)
As
/*Insert into HMonthOtherTotal (UnitID,YearMonth,Type1,Type2,Type3,Type4)
values (@UnitID,@YearMonth,@Type1,@Type2,@Type3,@Type4)
*/
Insert into HMonthOtherTotal(UnitID,YearMonth,Type1,Type2,Type3,Type4)
values (@UnitID,@YearMonth,@Type1,@Type2,@Type3,@Type4)
SET @PKID=SCOPE_IDENTITY();
return
Go
Insert into HMonthOtherTotal(UnitID,YearMonth,Type1,Type2,Type3,Type4)
values (2,'2008年10月',20,120,120,14)
execute HMonthOtherTotal_Insert 2,'2008年12月',20,120,120,14
最后两句是我插入数据的那种犯法,第一种直接插入是可以添加数据的,
但是第二种就不行了,报告错误:
服务器: 消息 8114,级别 16,状态 4,过程 HMonthOtherTotal_Insert,行 0
将数据类型 varchar 转换为 int 时出错。
快点解决啊,就要交项目了。
相关文章推荐
- 使用一个框架遇到问题,搜索到的办法都尝试了,无法解决,该怎么办
- rhce 第11题挂载一个nfs共享遇到的问题及解决办法
- 最近做的一个linux下的聊天系统,遇到的一些问题及解决办法
- 写一个之前遇到的问题,遇到ios项目中包含idfa的解决办法
- 真机调试遇到的一个证书问题以及解决办法
- 安装 Windows SDK for Windows 7 时遇到的一个问题及解决办法
- 安装Piwik时遇到的一个奇怪的关于PHP参数问题的解决办法
- 安装 Windows SDK for Windows 7 时遇到的一个问题及解决办法
- 关于BadgeView遇到的一个奇怪的问题和解决办法
- 在做一个android文本阅览器时遇到的问题及解决办法
- 开发Struts 2项目遇到的一个问题,就是在struts-tags标签库下没有了s:datetimepicker标签的解决办法
- 开发Struts 2项目遇到的一个问题,就是在struts-tags标签库下没有了s:datetimepicker标签的解决办法
- 创建并部署一个连接SQLAzure的WindowsAzure应用遇到的问题及解决办法
- 开发Struts 2项目遇到的一个问题,就是在struts-tags标签库下没有了s:datetimepicker标签的解决办法
- 开发Struts 2项目遇到的一个问题,就是在struts-tags标签库下没有了s:datetimepicker标签的解决办法
- 安装 Windows SDK for Windows 7 时遇到的一个问题及解决办法
- Spark中遇到的一些问题和相应的解决办法
- codeblocks编译遇到问题的可能解决办法
- 在Windows Server 2008中布置Web站点时遇到的问题及解决办法
- MySQL中日期比较时遇到的编码问题解决办法