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)
 Update based on update?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-10-29 : 08:31:48
g8054 writes "What I'm trying to do is have update2 happen based soley on the results of update1 Let me sort-of-pseudocode....

Update1

UPDATE MemberInfo
SET intAccountStatus = 0
WHERE (DATEDIFF (dd , dtAdded , getDate> 1)

Update2

UPDATE PropertyListing
SET intActive = 0
WHERE (fkCompanyID = "Whatever MemberInfo.ID was updated in Update1)

This is running as a scheduled update through ColdFusion.

So what I'm wondering is if UPDATE returns any sort of report or result set that I could use as the "Whatever MemberInfo.ID was updated in Update 1)

~g8054"

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-10-29 : 08:43:56
why don't you do them in the other order...

[code]
--Update 1
Update PropertyListing
Set intActive = 0
Where fkCompanyID = (Select id from memberInfo Where datediff(dd,dtAdded,getDate>1))

--Update 2
Update MemberInfo
Set intAccountStatus = 0
Where (datediff(dd,dtAdded,getDate>1)

Corey
Go to Top of Page
   

- Advertisement -