How to Concatenate Numbers and Strings to Format Numbers in T-SQL?

后端 未结 10 2036
借酒劲吻你
借酒劲吻你 2020-11-30 03:45

I have the following function

ALTER FUNCTION [dbo].[ActualWeightDIMS]
(
    -- Add the parameters for the function here
    @ActualWeight int,
    @Actual_D         


        
10条回答
  •  遥遥无期
    2020-11-30 04:12

    Try casting the ints to varchar, before adding them to a string:

    SET @ActualWeightDIMS = cast(@Actual_Dims_Lenght as varchar(8)) + 
       'x' + cast(@Actual_Dims_Width as varchar(8)) + 
       'x' + cast(@Actual_Dims_Height as varhcar(8))
    

提交回复
热议问题