Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Friday, June 21, 2024

Importing a bacpac file to a development box SQL

 Just to memorize some steps to import a database from a bacpac file.

  1. Download and run the DacFramework.msi installer for Windows
  2. Put the backup.bacpac file close to the SQL database, say, in the root folder on disk G:
  3. Run the bat file. 

@echo Importing a bacpac data to SQL database
c:
cd C:\Program Files\Microsoft SQL Server\160\DAC\bin
SqlPackage.exe /a:import /sf:G:\backup.bacpac /tsn:localhost /tdn:AxDB_Restored /p:CommandTimeout=1200 /TargetTrustServerCertificate:True
pause

Take note about the last option: without it importing fails with the following error.





Saturday, November 26, 2022

Get Infolog as a string

/// <summary>
/// Gets infolog content
/// </summary>
/// <returns>infolog string</returns>
public static str getErrorStr(container _cont)
{
	SysInfologEnumerator        enumerator;
	SysInfologMessageStruct     myStruct;
	Exception                   exception;
	str                         error;

	enumerator = SysInfologEnumerator::newData(_cont);

	while (enumerator.moveNext())
	{
		myStruct = new SysInfologMessageStruct(enumerator.currentMessage());
		exception = enumerator.currentException();

		error = strfmt('%1 %2', error, myStruct.message());
	}

	return error;
}