Hi,
i get it, if I assign one I have to assign them all.
Main Topics
Browse All TopicsThis seelct query is part of a bigger stored procedure that I have been messing with but in my latest version I get this error and its after I added the primary key intPositionId butI need this in there
Msg 141, Level 15, State 1, Line 5
A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: aneeshattingalPosted on 2009-08-25 at 07:05:41ID: 25177708
as the error says, you cannot assign values to the variables and return the value in the same query... you have to assign the values of these too to another two variables p.strPara, p.strline
Select @PositionId = p.intPositionId,
@para = p.strPara,
@line = p.strline,
@name = pp.strname,
@ssn = pp.strssn
from tblUnitDeploydata as dd Inner Join
tblUnitPosition as p on p.intUnitMobId = dd.intUnitMobId INNER JOIN
tblUnitPersonnel as pp on pp.intPositionId = p.intPositionId Inner JOIN
cms.dbo.tblSidpers as s on s.sidstrSSN_SM = pp.strSSN
where p.strGrade <> s.sidstrPay_GR And p.intUnitMobId = 445