January 25, 2006 at 7:45 am
Is there a way to set two variables with ONE select statement?
Example:
DECLARE @PartDescription varchar(36)
DECLARE @UnitOfIssue varchar (4)
DECLARE @ComponentPartNumber varchar(36)
SET @ComponentPartNumber = '314-019'
SET @PartDescription, @UnitOfIssue = (SELECT Description, UnitOfIssue FROM dbo.PartMaster WHERE PartNumber = @ComponentPartNumber)
The above line does NOT work, but it is what I am basically trying to do. I am trying to avoid two select statements. Not really a big deal, but it would make it cleaner. This is part of a stored procedure.
Thanks,
Jim Shipley
January 25, 2006 at 8:01 am
Hello Jim,
You can write it as follows:
Select @PartDescription = Description, @UnitOfIssue = UnitOfIssue FROM dbo.PartMaster WHERE PartNumber = @ComponentPartNumber
Thanks and have a nice day!!!
Lucky
January 25, 2006 at 8:05 am
Thanks! I knew there must be an easy way.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply