Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:56:48+00:00 2026-05-22T01:56:48+00:00

I have a data column that stores products distribution units as 1*1 or 1*2*6.

  • 0

I have a data column that stores products distribution units as 1*1 or 1*2*6. I want to formulate a computed column and have the result of the multiply problem.

below is illustrated example

sku       du      computed_du
12345678  1*2     2
12345679  1*3     3
12345680  1*6*2   12

Is there a most effective way to perform this calculation on sql server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:56:49+00:00Added an answer on May 22, 2026 at 1:56 am

    This is definitely something that should be calculated elsewhere, but I have seen the below technique used as a crude product aggregation.

    I am not positive about using this for computed column, but here is how you might pull it off: Wrap this in a function, schema bind it to your table, and reference it the computed column definition (not sure if mssql will allow this due to deterministic requirement of udf).

    Uses split function from here.

    declare @tab table (
        sku int,
        du varchar(10),
        computed_du int
    )
    insert into @tab
        select 12345678, '1*2', null union all
        select 12345679, '1*3', null union all
        select 12345680, '1*6*2*0', null
    
    -- 
    select sku, du, min(s), case when min(cast(s as int)) = 0 then 0 else exp(sum(log(cast(nullif(s, 0) as int)))) end
    from @tab
    cross
    apply   dbo.Split('*', du)d
    where cast(s as int)>0
    group
    by      sku, du;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with a data-bound DataGrid control, in that despite each column
I have some XML that stores column information and row data from a table
I have a column that has the following data: PersonId=315618 LetterId=43 MailingGroupId=1 EntityId=551723 trackedObjectId=9538
I have a varchar column that has data like this top<somenumber> so the word
I have a column of data that contains a percentage range as a string
I have some data that I am displaying in 3 column format, of the
I have some data that looks something like this... +----------+----------+----------+ | Column 1 |
I have to sort out my data by some column, such that some specific
I have a table of data that I need to dynamically add a column
I have an application with existing data, that has Zero in the date column.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.