declare @t table ([Ship Qty] int, Size varchar(128)) ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

-- Enter Query Title
-- Enter Query Description




declare @t table ([Ship Qty] int, Size varchar(128))
insert @t
          select 2, '1*100  EA'
union all select 3, '3*20 ML'


select  [Ship Qty]
,    Size
,    [Ship Qty] * Size1 * Size2
from  (
    select  cast(substring(Size, 1, StarPos-1) as int) as Size1
    ,    cast(substring(Size, StarPos+1, SpacePos-StarPos-1) as int) as Size2
    ,    *
    from  (
        select  patindex('%*%', Size) as StarPos
        ,    patindex('% %', Size) as SpacePos
        ,    *
        from  @t
        ) as SubQueryAlias1
    ) as SubQueryAlias1

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results