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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 subquery

Author  Topic 

Ex
Posting Yak Master

166 Posts

Posted - 2004-12-30 : 18:14:15
hey all i need to convert this update statment into a subquery

UPDATE ent
SET TotalDimElements = TotalDimElements / def.Evaluated
FROM dbo.ENTITY_ITEM_VIEW ent,
deleted del,
dbo.DEFINE def
WHERE ent.EntityItemID = del.ENTITYITEMID AND ent.MajorBuildNo = 0 AND ent.MinorBuildNo = 0
AND del.DIMENSIONNO <> 0
AND def.defineid = del.DEFINEID AND def.MajorBuildNo = 0 AND def.MinorBuildNo = 0


wondering if it is possible not sure how to get the set statment to work if it is in a subquery wondering if there is a way that i am not seeing,


i have to change it to a subqery because i cant use the view in the from clause as its has a instead of update trigger on it


any ideas ? or different approaches?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-30 : 18:25:30
well can't you update the table directly instead of the view?

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Ex
Posting Yak Master

166 Posts

Posted - 2004-12-30 : 18:27:51
not really,

i created the view cause for some unknown reason i was getting deadlock, this was on a interbase database
now i am just porting it over to sql server so i haven't really tested it withouth the view but a assumption is the deadlock would still occur, spent ages trying to find it on interbase but got lost in the end,

that is why i wanted to try it this way first if there is a way that is :)
Go to Top of Page
   

- Advertisement -