roy himanshu

roy himanshu

  • NA
  • 126
  • 0

How to insert different records into multiple sql tables with same uniqueidentifier in sql server

Aug 31 2009 4:38 AM

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

Answers (2)