Data import export framework – get staging data error in AX 2012

SQL error description: [Microsoft][SQL Server Native Client 10.0][SQL Server]The specified schema name “<schema name>” either does not exist or you do not have permission to use it.

We can see in the SQL statement:
SQL statement: CREATE FUNCTION [<schema name>].FN_FMT_NUMBERSEQUENCE
Error is thrown when function FN_FMT_NUMBERSEQUENCE is created and used schema name looks to be invalid.
Schema name is obtained in function DMFGenerateSSISPackage::getSchemaName (see below):
private static str getSchemaName()
{
ResultSet resultSet;
str sql_Current_user = 'SELECT current_user';
str schemaName;
Connection con;
SqlStatementExecutePermission sqlStatementExecutePermission;
...
}
The original code: ‘SELECT current_user’ instead of expected “dbo” can return AOS service account. To solve this issue we need just to change it to SELECT SCHEMA_NAME()
private static str getSchemaName()
{
ResultSet resultSet;
//-->
// str sql_Current_user = 'SELECT current_user';
str sql_Current_user = 'SELECT SCHEMA_NAME()';
//<--
str schemaName;
Connection con;
SqlStatementExecutePermission sqlStatementExecutePermission
...
}
See more

AGA pomaga – poznaj inteligentnego asystenta do przetwarzania zapytań ofertowych: ANEGIS Generative Assistant

Jak z pomocą narzędzi Power Platform, Microsoft Fabric i AI zrealizować plan na cyfrową transformację? ANEGIS Power Center

Obowiązkowy KSeF startuje za 4 miesiące! Umów się na bezpłatne konsultacje i przygotuj swój system na zmiany
Let's talk about your project
Let us know what you need: implementation, migration, system development, or a question you’re looking to have answered. We’ll get back to you with a concrete proposal for the next step - not a sales pitch.

