B1SA.HanaTranslator 2.2.1

dotnet add package B1SA.HanaTranslator --version 2.2.1
                    
NuGet\Install-Package B1SA.HanaTranslator -Version 2.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="B1SA.HanaTranslator" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="B1SA.HanaTranslator" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="B1SA.HanaTranslator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add B1SA.HanaTranslator --version 2.2.1
                    
#r "nuget: B1SA.HanaTranslator, 2.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package B1SA.HanaTranslator@2.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=B1SA.HanaTranslator&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=B1SA.HanaTranslator&version=2.2.1
                    
Install as a Cake Tool

B1SA.HanaTranslator

SMS Fork

  • The main focus of our changes were easy consumption of the SQL string translation feature as a NuGet package
  • This library is based on the Query Migration Tool for Microsoft SQL Server to SAP HANA, which is marked as being archived
    • fork date: 2017-11-10
    • git revision: e53f0ecce5fabdac2c5787ae1311437a148552e5
  • Like the original code the changes are licensed under the MIT license as well
    • The used ANTLR libraries are licensed under the BSD license

Changes

  • Bumped version to 2.x.x to distinguish from the original code
  • Targeting .NET Standard 2.1 (compiled with VS 2022)
  • ANTLR
    • Based on version 3.5.2-rc1, which is marked as a Release Candidate, but works as expected and seems to stay the last release of the version 3 branch
    • Integrated & adapted Antlr3.Runtime source to also target .NET Standard 2.1
    • Use official Antlr3 (Generator) package instead of local one. It only supports .NET Standard 2.0, but is solely used during build-time to generate the parser and lexer code, which takes a few moments
  • Removed UI project that was just a consumer of the library
  • Removed DB connectivity and with it the automatic case fixing
  • Repository clean up & streamlining for packaging
  • Replaced static file config.txt with a non-static Config object
  • Moved to the more unique and origin honouring namespace B1SA.HanaTranslator
  • Added rudimentary unit tests
  • And many more small improvements...

Usage

using B1SA.HanaTranslator;

var translator = new Translator(new Config() {
    TranslationComments = true,
    FormatOutput = true
});

var hanaSql = translator.Translate(
    """
    SELECT "Item", ISNULL("Quantity", 0) AS "Quantity" FROM "Table"
    """,
    out string summary,
    out int statements,
    out int errors
);

The original README

Query Migration Tool for Microsoft SQL Server to SAP HANA

The Query Migration Tool for Microsoft SQL Server to SAP HANA is a semi-automatic tool that helps convert most of the data-definition language (DDL) and data-manipulation language (DML). It will help you to convert structured query language (SQL) in the Microsoft SQL Server database (using T-SQL grammar) to SQL that can be used in the SAP HANA™ database (using ANSI-SQL grammar).

After the conversion, you must check whether the converted version is correct according to your needs.

This tool supports most of the official T-SQL grammar, and some well-known and widely-used undocumented feature. For more information about the official T-SQL grammar, see the MSDN Library.

If SAP HANA does not support certain SQL, this tool will do the following:

  • Find equivalents in the SAP HANA database and convert the SQL.
  • Delete the SQL in the input file and display relevant comments in the output file.
  • Leave the SQL in the input file as it is, for example, the WITH statement.

In order to find out more details please follow the details on the SAP community blog https://blogs.sap.com/2013/04/10/how-to-convert-sql-from-ms-sql-server-to-sap-hana/.

Prerequisites

The provided source code is a .NET solution. You will need Microsoft Visual Studio installed in your own environment to be able to recompile the provided source code.

License
  • There is no guarantee or support on the provided source code.
  • The provided source code might use external frameworks and libraries, pay attention if you are building a product that you have the required licenses.
  • The Query Migration Tool for Microsoft SQL Server to SAP HANA is released under the terms of the MIT license. See LICENSE for more information or see https://opensource.org/licenses/MIT.
Special thanks

Thanks to the SAP Business One development team for his collaboration on getting this tool implemented and published here.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 237 9/29/2025
2.0.1 415 3/25/2024