Float in RaiseError

how to display the variable of float type in Raiserror statement in sqlsver,
see my below code.

--in below select state, i have added only fQtyLastProcess
                  Select @cLotNo = cLotNumber,@fQtyLastProcess = fQtyLastProcess From _btblInvoiceLines
                  Where iInvoiceID in ( Select AutoIndex From Inserted Where DocFlag <> 2)
--Add by Ramzan following block is added
                  SELECT    @fQtyExisting= isnull(sum(dbo._etblLotTrackingQty.fQtyOnHand),0) FROM dbo._etblLotTracking INNER JOIN
            dbo._etblLotTrackingQty ON dbo._etblLotTracking.idLotTracking = dbo._etblLotTrackingQty.iLotTrackingID
                  WHERE     (dbo._etblLotTracking.cLotDescription <> 'OPENING') AND (dbo._etblLotTrackingQty.fQtyOnHand <> 0) and cLotDescription = @cLotNo
                  if ((@fQtyLastProcess + @fQtyExisting)>30)
                        raiserror('Qty Cannot be More than 30MT. in %d',16,1,Convert(VARCHAR(10), @fQtyLastProcess))
--end by Ramzan
my raiserror statement is giving error.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this:
Declare @ErrorMsg Varchar(Max)
Set @ErrorMsg = ''Qty Cannot be More than 30MT ' + Cast(@fQtyLastProcess as Varchar(20))
   if ((@fQtyLastProcess + @fQtyExisting)>30)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Write RAISERROR('Qty Cannot be More than 30MT. in ' + CONVERT(VARCHAR(10),CONVERT(numeric(16,3),@fQtyLastProcess)))
I hate to be the bearer of bad news, but floats cannot be used for the Argument parameter.  Only tinyint, smallint, int, char, varchar, nchar, nvarchar, binary, or varbinary can be used.  But I think you might be able to try this workaround:

Shannon Lowder
Database Engineer
--try this:
DECLARE @varchar_fQtyLastProcess VARCHAR(10)
SET @varchar_fQtyLastProcess = CONVERT(VARCHAR(10), @fQtyLastProcess)
RAISERROR('Qty Cannot be More than 30MT. in %s',16,1,@varchar_fQtyLastProcess)

---in place of 
 raiserror('Qty Cannot be More than 30MT. in %d',16,1,Convert(VARCHAR(10), @fQtyLastProcess))

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.