sql - Change table data -


Hope this will be easy for this community. I'm a bit of a beginner I'm working on MS SQL Server 2008, I need to change some table data in a stored procedure.

  SELECT quantity, widgetNume, color from where  

I table data is as follows:

  Quantity | Widgets | Color ----------------------------- 2 | 100 weights-two White 1 200 wedget-three | Black  

I need to convert it to the following table data:

  Quantity | Widgets | Color ----------------------------- 4 | 100 weightsgate. White 3 200widget | | Black  

I probably have 100 or so widget numbers and the table has thousands of records. Thank you

If I understand your problem properly then this should do the trick:

< Update> where SET volume = quantity * (in case the '% -TW' widget like '% -TW' then when '% -TWO' like widgetnum 2 then when like '% -theme' Widgetnum 3 when less than 3ds like widgetnum '% -THRE'), widgetmum = (in case the widget '% -TW' is like '% -TW' (widget, '- TW', '') Replace the widget again like '% -TWO' (widget, '- 2', '' when '% -THRE' widget like '% -THRE' Widgets like Widgets (widget, '- THRE', ''), then '% - theme' (widget, '- 3', '') code>

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -