Syntax problems

  • Hello!

    Having problems with a query(SP) here.

    I was trying to check if a value is NULL (Divide by null), but I can't make it work.

    Here is my code;

    declare @UnitWeight as Real

    set @UnitWeight = 1

    SELECT SUM(FVALUE) as fVal from ITEM

    SET @UnitWeight = fVal //Here I get an error saying: "Invalid column Name 'fVal'

     

    Can anyone help me please


    -Lars

    Please only reply to this newsgroup. All mails would be bounced back.

  • Hi Lars,

    Below is the corrected syntax.

    declare @UnitWeight as Real,

    @fVal as Real

    set @UnitWeight = 1

    set @fVal=0

    SELECT @fVal=SUM(isnull(FVALUE,0))  from ITEM

    SET @UnitWeight = @fVal

    Pls check it out.

    Nitin

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply