updated ssql for demp purpose