Sameh
Sameh

Reputation: 1020

SQL Server Query Strange Output

I have the following SQL Server query:

SELECT ISNULL(MIN(P), 999) AS FLD
FROM (SELECT '0' AS P) AS T
WHERE (1 > 4)

How come the output of this query is '*' ?

Please explain

Thanks

Upvotes: 4

Views: 162

Answers (1)

Martin Smith
Martin Smith

Reputation: 453287

ISNULL uses the datatype of the first argument.

This is varchar(1) as that is the datatype of the literal '0'

999 would be truncated so SQL Server shows '*'

Upvotes: 11

Related Questions