Creating getpidms SQLQuery