declare @myKey uniqueidentifier
select
@myKey = newId()
insert into persons (id,lastname,firstname)
values(@myKey,'hai','world')
insert into persons1(id,c1,c2)
values(@myKey,'hello','roy')
hi,this is my code.but still now iam getting error.the error message also i pasted here.plz rectifie my problem,plz.iam faceing this problem since several hours.plz help me. the error message is
Msg 206, Level 16, State 2, Line 5
Operand type clash: uniqueidentifier is incompatible with int
Msg 206, Level 16, State 2, Line 9
Operand type clash: uniqueidentifier is incompatible with int
Roei BarRank #1,271 · 1.4K reputationPosted Aug 31, 2009, 2:47 AM EDT
here is the fixed Command:
declare @myKey int select @myKey = scope_identity() insert into persons (id,lastname,firstname) values(@myKey,'hai','world') insert into persons1(id,c1,c2) values(@myKey,'hello','roy')roy himanshu98 reputationPosted Aug 31, 2009, 3:17 AM EDT
himanshu