Ron Moore
rmoore at comtechpst.com
Fri Nov 19 09:16:40 CST 2004
I'm trying to stuff a flag when changes exist in metadata and have been
unsuccessful using a SELECT TOP 1 fieldname, as well as SELECT
COUNT(fieldname). Currently trying the count approach as that would give me
the magnitudes of changes, and the SQL string looks like:
UPDATE PLAN_STAGE.dbo.S2B_MD_DT_CHANGES
SET MD_CHANGES = (SELECT COUNT(CHILD)
FROM
PLAN_STAGE.dbo.DATA_SOURCE_ACCOUNT_TMP
WHERE CHILD IS NOT NULL)
FROM PLAN_STAGE.dbo.S2B_MD_DT_CHANGES,
PLAN_STAGE.dbo.DATA_SOURCE_ACCOUNT_TMP
I have also tried substituting the following WHERE EXISTS in place of the
last FROM line in above SQL string:
WHERE EXISTS (SELECT COUNT(CHILD)
FROM
PLAN_STAGE.dbo.DATA_SOURCE_ACCOUNT_TMP
WHERE CHILD IS NOT NULL)
The select portion by itself works, but the update returns '(0 row(s)
affected)'. What am I missing here?
Thanks in Advance,
Ron Moore