Use correct buildDSRetrievalSQL function instead of the old typo'd version