Forum Stats

  • 3,783,382 Users
  • 2,254,767 Discussions


Add the SUBSTRING alias for the SUBSTR function

iwis Member Posts: 12 Green Ribbon


I compared string functions in 5 different RDBMS: PostgreSQL, MySQL, Oracle, SQL Server and SQLite, and also in the ANSI SQL Standard. There are large differences among different RDBMS, and I propose to reduce them a little bit.

Particularly, I propose to add the SUBSTRING alias for the SUBSTR function.

Explanation: This is the current syntax of the SUBSTR[ING] functions in ANSI standard and in different RDBMS:

ANSI standard:      SUBSTRING   (s FROM start [FOR length])
PostgreSQL & MySQL: SUBSTR[ING] (s, start [,length])
Oracle & SQLite:    SUBSTR      (s, start [,length])
SQL Server:         SUBSTRING   (s, start  ,length )

To unify the syntax, I propose to add the SUBSTRING alias to the SUBSTR function in Oracle. SQLite already will support the SUBSTRING alias from the 3.34 version. If Oracle does the same, we will be able to use the SUBSTRING(s, start, length) syntax in all above-mentioned RDBMS. This will make the SQL Server syntax compatible with all major RDBMS. Hopefully this would be another step to help C# programmers switch from SQL Server to other databases. I think it is worth to think about it, especially after the latest release of the .NET 5 framework, which unifies the old .NET Framework and .NET Core, into the single multi-platform framework able to be run on Windows and Linux.

I also proposed this change:

The changes proposed by me for other RDBMS are listed here:

1 votes

Active · Last Updated