public function parseFieldForSelect($as_quoted_string = false) { $field = $as_quoted_string ? $this->rawName : $this->name; $alias = $this->getName(true); switch ($this->dbType) { case 'datetime': case 'datetimeoffset': return "(CONVERT(nvarchar(30), {$field}, 127)) AS {$alias}"; case 'geometry': case 'geography': case 'hierarchyid': return "({$field}.ToString()) AS {$alias}"; default: return parent::parseFieldForSelect($as_quoted_string); } }