问题描述
我有一个表有11个字段.field1(id)是主键标识(1,1)。我想同时将id的值保存到另一个字段。另一个字段名是fid int.i am newer.help me
我的尝试:
BEGIN
声明faid int;
插入成员(id,Name,Fname,Gender,Add1,Add2,District,Pincode,Mobile,Email,Occupation,DateofBirth)值(id ,name,fname,gender,add1,add2,district,pincode,mobile,email,occupation,dateofbirth);
从会员中选择faid = MAX(id);
插入成员(fid)值(faid);
END
I have one table which has 11 field.field1(id) is primary key identity(1,1).i want to save the value of id to another filed at same time.another filed name is fid int.i am newer.help me
What I have tried:
BEGIN
declare faid int;
insert into member(id,Name,Fname,Gender,Add1,Add2,District,Pincode,Mobile,Email,Occupation,DateofBirth) values(id,name,fname,gender,add1,add2,district,pincode,mobile,email,occupation,dateofbirth);
select faid=MAX(id) from member;
insert into member(fid)values (faid);
END
推荐答案
这篇关于如何将一个字段值插入同一个表的另一个字段,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!