JeffCarlin
Programmer
Here's the current code, where "@Parm1" is the passed table name:
Running this produces NULLs in the dteLast column. If I remove the MAX, the code works, but of course, only returns the first value found. Can anyone figure this out?
Thanks.
Code:
BEGIN
SET @stg1 =
"UPDATE " + @Parm1 + " " +
"SET dteLast = " +
"(SELECT MAX(tblHealth.dteDateEntry) " +
"FROM tblHealth " +
"WHERE tblHealth.strHealthPatSSN=" + @Parm1 + ".strSSN " +
"AND tblHealth.strHealthPatTreatNum=" + @Parm1 + ".strTreat) "
EXECUTE (@stg1)
END
Running this produces NULLs in the dteLast column. If I remove the MAX, the code works, but of course, only returns the first value found. Can anyone figure this out?
Thanks.