April 21, 2010 at 10:42 pm
Here is my code
DECLARE @QtyPerUnitMeasure DECIMAL(38,20)
DECLARE @QryQtyPerUntMsr NVARCHAR(2000)
SET @QryQtyPerUntMsr='SELECT @QtyPerUnitMeasureOUT=[Qty_ per Unit of Measure] FROM
['+@CompanyName+'$Item Unit of Measure] AS ItmUnitMeas
WHERE ItmUnitMeas.[Item No_]='''+@ItemNo+''' AND ItmUnitMeas.[Code]='''+@UnitMeasureCd+''''
EXEC SP_EXECUTESQL @QryQtyPerUntMsr, N'@QtyPerUnitMeasureOUT DECIMAL(38, 20) OUTPUT',
@QtyPerUnitMeasureOUT = @QtyPerUnitMeasure OUTPUT
SELECT @QtyPerUnitMeasure
I am getting result as 'Qty_ per Unit of Measure'.I want the result in a variable. '@QtyPerUnitMeasure' returning NULL.Please help me
April 21, 2010 at 11:15 pm
One of the local variable is initiated to NUL, buddy... Check up all of your local variables for null and then include them in your dynamice sql..
April 21, 2010 at 11:49 pm
Instead of your statement:
@QtyPerUnitMeasureOUT = @QtyPerUnitMeasure OUTPUT
SELECT @QtyPerUnitMeasure
try this:
SELECT @QtyPerUnitMeasure=@QtyPerUnitMeasureOUT
---
Thinking is the hardest work there is, which is the probable reason so few engage in it.
Sunitha
😎
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply