• Hugo Kornelis (10/15/2010)


    tilew-948340 (10/15/2010)


    Hi Hugo.

    The first time I tried the PERSISTED, I got the divide by zero error AFTER the "show table" wich does not seem to be, as I understand it, what it should be doing. So I tried many "set" option, wich brought me to the "declare" error...

    So, if I put the PERSISTED word, should not the error happend after the "Insert null"?

    Here is the code that I used - if you compare this to the QotD, you'll see that adding PERSISTED at one place is the only modification.

    ...

    If I run this (from SSMS, against SQL Server 2005), I get an error after "Insert Zeroes", and a result set with two rows (one with values; one with NULLs)

    ah! HA! I knew I was doing someting wrong. I was putting the "PERSISTED" after the "QTot AS QF1 + QF2", wich mean nothing for a division by zero. Now, I do understand what "persisted" do!

    Thank you very much!