Links

MSCEWI4031

Information for the expression was not found. CAST to STRING used

Severity

Medium

Description

This EWI is added in Table-Valued User Defined Functions where the return type of an expression can not be determined during the conversion. CAST A STRING operation is used to match the default STRING datatype in the RETURNSstatement

Code Example

Input Code:

CREATE FUNCTION GetDepartmentInfo()
RETURNS TABLE
AS
RETURN
(
SELECT DepartmentID, Name, GroupName
FROM HumanResources.Department
);

Output Code:

CREATE OR REPLACE FUNCTION GETDEPARTMENTINFO()
RETURNS TABLE(DEPARTMENTID STRING /*** MSC-WARNING - MSCEWI4029 - INFORMATION FOR THE COLUMN DEPARTMENTID WAS NOT FOUND. STRING DATATYPE USED TO MATCH CAST AS STRING OPERATION ***/, NAME VARCHAR(50), GROUPNAME VARCHAR(50))
AS
$$
SELECT CAST(DEPARTMENTID AS STRING) /*** MSC-WARNING - MSCEWI4031 - INFORMATION FOR THIS EXPRESSION WAS NOT FOUND. CAST TO STRING USED TO MATCH THE DEFAULT STRING RETURN TYPE ***/, NAME, GROUPNAME
FROM HUMANRESOURCES.DEPARTMENT
$$;

Recommendations

Last modified 10mo ago