日期:2014-05-18  浏览次数:20550 次

又是基础问题,还要请教大家了
引用
use myschool
go
insert into Student(StudentNo,StudentName,Sex,GradeId,Phone,LoginPwd)
values('s1122340','张三','男',1,'0351445325','z');
go


错误信息:
消息 245,级别 16,状态 1,第 1 行
在将 nvarchar 值 'z' 转换成数据类型 int 时失败。
LoginPwd属性:
非主键,数据类型nvarchar(50),不允许NULL值


求教,我这个LoginPwd到底哪里错了?明明类型应该是正确的啊,输入却提示转换INT值失败—
搞不懂,搞不懂啊…

------解决方案--------------------
SQL code

if object_id('StudentCopy') is not null
drop table StudentCopy
go
create table StudentCopy(
StudentNo nvarchar(50) not null primary key,
LoginPwd nvarchar(50) not null,
StudentName nvarchar(20) not null,
Sex char(2) not null,
GradeId int not null,
Phone nvarchar(255) not null,
Address nchar(255),
BornDate datetime null,
Email nvarchar(255) null
)
go
insert into StudentCopy(StudentNo,StudentName,Sex,GradeId,Phone,LoginPwd)
values('s1122340','张三','男',1,'0351445325','z');
--(1 行受影响)
--真不清楚你的是什么问题,也不是触发器的问题,若是,则提示信息不会是这个,你不会是在耍大家吧,呵呵

------解决方案--------------------
我发现你的建表的那个有个* 
啊是不是没有保存的缘故