Ispirer Website Ispirer Capabilities: PostgreSQL Migration Free Trial

User Table-Values Types Conversion from Microsoft SQL Server to PostgreSQL

User table-value data types are not supported in the PostgreSQL database, but these objects are very often used in other databases, such as Microsoft SQL Server. Since migrations from Microsoft SQL Server to PostgreSQL are popular, issues often arise when migrating these objects. In Microsoft SQL Server, variables of user table-value data types are used as local variables and as parameters of procedures, functions, etc. To emulate the user table-value data types when migrating from Microsoft SQL Server to PostgreSQL, you can use the temporary tables. Let's have a look in more detail: Let`s use the following example of such cases when converting from Microsoft SQL Server to PostgreSQL:

1. All local variables of table-value datatypes are converted into temporary tables with columns of the source datatype and named SWT_[variable name].
2. From there, these temporary tables are used instead of variables everywhere.
3. The parameters of table-value datatype are converted as follows:

  • Instead of a tabular parameter, a parameter of type VARCAHR(64) is used in which a temporary table name is passed instead of a tabular variable.
  • The procedure body dynamically creates a temporary table, which is filled with values from the table specified in the parameter.
  • The dynamically created temporary table is used instead of parameter in the parent procedure.

4. When you call the parent procedure with a table type parameter, the child procedure uses the name of the temporary table, which is used instead of the table variable.

We hope this case will be helpful if you encounter the task of transferring user table-value data types to PostgreSQL. This solution is automatically executed by our software SQLWays Toolkit. You can learn more about other features of the conversion toolkit, as well as try out a demo license on our website.


If you have any questions or face any difficulties, please contact our support team: support@ispirer.com