Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fm88
Starting Member
18 Posts |
Posted - 2008-10-29 : 06:06:41
|
| i have 2 tables : tblMember(memberid,name,...) and tblmemberServiceRolei want to insert in tblmemberServiceRole -max(memberid) from tblMember-servicerole which is another variablein the same querythanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-29 : 06:08:55
|
| [code]insert into tblmemberServiceRoleselect max(memberid),@servicerole from tblMember[/code] |
 |
|
|
fm88
Starting Member
18 Posts |
Posted - 2008-10-29 : 06:24:13
|
| @servicerole is not a column in tblMember...in tblmemberServiceRole the first column max(memberid) and the second column is another value... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-29 : 06:26:37
|
quote: Originally posted by fm88 @servicerole is not a column in tblMember...in tblmemberServiceRole the first column max(memberid) and the second column is another value...
i know that. where does that value come from? i thought you would sending it through parameter thats why i gave parameter name. |
 |
|
|
ursangel
Starting Member
17 Posts |
Posted - 2008-10-29 : 11:31:43
|
| fm88 please be clear on the input values for the tblMemberServiceRolewhat visakh16 has mentioned in correct.Its a simple insert into select statement.But specify the 2nd column value.declare @servicerole varchar(50);set @servicerole = 'Test' -- change to the role descriptioninsert into tblmemberServiceRoleselect max(memberid),@servicerole from tblMemberRegardsAngel |
 |
|
|
|
|
|