I have order table
OrderId OrderStatusId CurrencyId PromotionCode
------------------------------------------------------
137 5 1 123a-123d
138 5 1 123a-123d-234c
I want to split the PromotionCode column like this:
Result:
OrderId OrderStatusId CurrencyId PromotionCode
-----------------------------------------------------
137 5 1 123a
137 5 1 123d
138 5 1 123a
138 5 1 123d
138 5 1 234c
Please help me …
is it possible to do… any way plz help me asas possible….
If the promotion codes are always 4 characters long, the simplest way is probably a union:
For a more flexible solution, have a look at one of the various Split functions. After creating this function in your database, you can invoke it like:
Both queries will produce the result as requested in your answer.