Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Updatable view or other idea
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

219 Posts

Posted - 11/06/2013 :  13:02:21  Show Profile  Click to see mike13's MSN Messenger address  Reply with Quote
HI all,

I got new field in my t_product_option

i added a quantity numeric field
now i got a char field
that show
1 gram
5 gram

that why created the new field
so i can add

but now i want, to update my product options
i cannot do automatic to many different options.

so i wanted to do it manual, i thought of a updatable view.
I need to add the productname (T_product_main) so i can see what the option is referring to.

i made a view:

CREATE VIEW [dbo].[V_product_option_numeric]
SELECT dbo.T_Product_Main.ProductName,, dbo.T_Product_Option.Quantity, dbo.T_Product_Option.QuantityNumeric, AS optionid
FROM dbo.T_Product_Main INNER JOIN
dbo.T_Product_Option ON = dbo.T_Product_Option.ProductID
WHERE (dbo.T_Product_Main.Active = 1) AND (dbo.T_Product_Option.Stock = 1)

But i only need to update only table T_Product_Option.

i get the error

Or in SQL management studio


Edited by - mike13 on 11/06/2013 13:07:33

Flowing Fount of Yak Knowledge

8781 Posts

Posted - 11/07/2013 :  10:28:16  Show Profile  Visit webfred's Homepage  Reply with Quote

update po
set QuantityNumeric = replace(po.Quantity,' gram','')
from dbo.T_Product_Main pm
INNER JOIN dbo.T_Product_Option po ON = po.ProductID
WHERE (pm.Active = 1) AND (po.Stock = 1)

Too old to Rock'n'Roll too young to die.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000