Skip to content

SQL: CONCAT should return NULL when the field involved has a NULL value? #36169

@astefan

Description

@astefan

SQL Server 2017, by default, will consider null values in CONCAT() function as empty strings and return a non-null value. But, it also offers the option of changing this setting by using CONCAT_NULL_YIELDS_NULL setting. They do warn, though, that this option will be ON in a future version of SQL Server: https://docs.microsoft.com/en-us/sql/t-sql/statements/set-concat-null-yields-null-transact-sql?view=sql-server-ver15. The preview docs for SQL Server 2019 does still have the option default as OFF (so null is considered empty string).

PostgreSQL will also "ignore" null values and treat them as empty strings: https://www.postgresql.org/docs/11/functions-string.html

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions