OFFICIUM INSERVIO IT
Your reliable partner for your business software...
Search Results
Diese Website durchsuchen
320 Ergebnisse gefunden mit einer leeren Suche
- FilePermissionsNtfs
FilePermissionsNtfs <<< Sage 100 Ordner-Berechtigungen (Ntfs) prüfen / Check directory permissions (Ntfs) (alle Versionen/all versions) Mittwoch, 25. Oktober 2023 Deutsch Powershell Script für Prüfung der Rechte Powershell Script für Übernehmen von Basis-Ordner-Rechten auf alle untergeordneten Elemente Weitere wichtige Ordner Microsoft Tool "AccessEnum" Deutsch Powershell Script für Prüfung der Rechte Mit nachfolgendem Powershell Script können die NTFS Rechte auf das Sage Installationsverzeichnis ausgewertet werde Man speichert das Script in einem Ordner z.B. als " PowershellRights.ps 1" und startet dann die PowerShell im Administrator-Modus. Dann das Script aufrufen. Das Script erzeugt die Datei "C:\Permissions_Ntfs_Sage100.csv" mit den entsprechenden Informationen. Script: $OutFile = "C:\Permissions_Ntfs_Sage100.csv" $Header = "Folder Path,IdentityReference,AccessControlType,IsInherited,InheritanceFlags,PropagationFlags" Del $OutFile Add-Content -Value $Header -Path $OutFile $RootPath = "c:\Program Files (x86)\Sage\" $Folders = dir $RootPath -recurse | where {$_.psiscontainer -eq $true} foreach ($Folder in $Folders){ $ACLs = get-acl $Folder.fullname | ForEach-Object { $_.Access } Foreach ($ACL in $ACLs){ $OutInfo = $Folder.Fullname + "," + $ACL.IdentityReference + "," + $ACL.AccessControlType + "," + $ACL.IsInherited + "," + $ACL.InheritanceFlags + "," + $ACL.PropagationFlags Add-Content -Value $OutInfo -Path $OutFile }} Powershell Script für Übernehmen von Basis-Ordner-Rechten auf alle untergeordneten Elemente Mit nachfolgendem Powershell Script können die NTFS Rechte , die auf einem Haupt-Ordner gesetzt sind , vollautomatisch rekursiv auf alle untergeordneten Verzeichnisse und Dateien übertragen werden. Dies ist besonders nützlich , da somit lediglich auf einem übergeordneten Ordner alles eingestellt werden muss. Das Script protokolliert alle Probleme in einer Textdatei. Vorbereitet ist das Script für den Roaming-Ordner eines Users , in dem Fall Username "SAG". Dieser Roaming-Ordner macht regelmäßig in der Sage 100 Probleme , wenn die Rechte für einen Benutzer nicht vorliegen. # This script applies all rights of a main folder to all children in the folder recursively. All errors are reported into a log file. # Just set the rights you need on the main level , like on the folder "C:\Users\SAG\AppData\Roaming" , for all required users. # Then execute this script with admin rights! param ( [string]$TargetPath = "C:\Users\SAG\AppData\Roaming", [string]$LogFile = "C:\SAGRights_problems.txt" ) if (Test-Path -LiteralPath $LogFile) { Clear-Content -LiteralPath $LogFile -ErrorAction SilentlyContinue } $items = Get-ChildItem -LiteralPath $TargetPath -Recurse -Force foreach ($item in $items) { try { $acl = Get-Acl -LiteralPath $item.FullName -ErrorAction Stop $acl.SetAccessRuleProtection($false, $false) $explicitRules = $acl.Access | Where-Object { $_.IsInherited -eq $false } foreach ($rule in $explicitRules) { $acl.RemoveAccessRule($rule) | Out-Null } Set-Acl -LiteralPath $item.FullName -AclObject $acl -ErrorAction Stop } catch { $errorMessage = "Failed to update rights for: '$($item.FullName)' - Error: $($_.Exception.Message)" Add-Content -LiteralPath $LogFile -Value $errorMessage } } Write-Host "Process completed. Please check $LogFile for any errors." Weitere wichtige Ordner Es sollte beachtet werden , dass der im Script genannte Ordner lediglich einer der wichtigsten Ordner der Sage Installation ist. Es gibt jedoch noch jede Menge weitere Ordner , die man ebenfalls prüfen sollte. www.officium-inservio.com Sage100InstallationPathOverview Sage100InstallationPathOverview Microsoft Tool "AccessEnum" Alternativ kann man das Microsoft Tool "AccessEnum" aus den "Sysinternals" verwenden. learn.microsoft.com AccessEnum - Sysinternals This simple yet powerful security tool shows you who has what access to directories, files and Registry keys on your systems. <<< >>>
- ErrorVpn1
ErrorVpn1 <<< Sage 100 remote - VPN Probleme / VPN problems (alle Versionen/all versions) Donnerstag, 1. Dezember 2022 Deutsch Fehlermeldung/Situation Konsequenzen Mögliche Ursachen Mögliche Lösungen English Error message/situation Consequences Possible reasons Possible solutions Deutsch Fehlermeldung/Situation Wer Microsoft-VPN verwendet, um z.B. mit Remote-Desktop aus dem Home Office auf eine installierte Sage 100 zuzugreifen, kann nach Microsoft Sicherheitsupdates mit VPN-Authentifizierungsproblemen konfrontiert werden! Fehler beim Testen der Verbindung durch einen Fehler beim Initialisieren des Providers.Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Konsequenzen Auswirkung ist, dass das VPN-Ammeldeverhalten in Kombination mit "klassischer" Microsoft Windows Authentifizierung nicht mehr funktioniert. Das Anmeldetoken wird auch nicht an SQL-Server für Anmeldung über Windows Authentifizierung weitergeleitet, obwohl alle Anmeldedaten korrekt angegeben wurden (inkl. AD/Domäne als Präfix). D.h. die Anmeldung wird nicht korrekt an das Active Directory/die Domäne weitergeleitet und somit funktionieren dann auch sämtliche Windows Authentifizierungen wie SQL Server Windows Authentifizierung nicht mehr! Mögliche Ursachen Microsoft Sicherheitsupdates können die VPN Anmeldeprobleme verursachen. Mögliche Lösungen Aktuell scheint ausschließlich ein Rollback zu helfen, d.h. das jeweilige Microsoft Update, welches das Problem verursacht, muss deinstalliert werden. Nach Deinstallation dieses Updates KB5011503 funktionierte die VPN-Anmeldung in einer unserer Umgebungen wieder. Je nach Betriebssystem kann dies auch KB5008353 verursachen, siehe KB5008353 causes Windows Authentication connections to SQL Server to fail over VPN . Oder auch KB4535996, siehe Windows 10: KB4535996 sorgt für Probleme bei VPN-Verbindungen . English Error message/situation Anyone using Microsoft-VPN , e.g., accessing an installed Sage 100 with a remote desktop from the home office , can be confronted with VPN authentication problems after Microsoft security updates! Fehler beim Testen der Verbindung durch einen Fehler beim Initialisieren des Providers.Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Consequences The VPN login behaviour no longer works in combination with "classic" Microsoft Windows authentication. The login token is also not forwarded to the SQL server for login via Windows authentication, although all login data might have been entered correctly (incl. AD/domain as a prefix) by the user. This means that the VPN login is not correctly forwarded to the Active Directory/domain; therefore, all Windows authentications, such as Microsoft SQL Server Windows authentication, no longer work! Possible reasons Microsoft security updates may cause VPN sign-in issues. Possible solutions Currently, only a rollback seems to help, i.e. the respective Microsoft update that causes the problem must be uninstalled. After uninstalling this update KB5011503, the VPN login worked again in one of our environments. Depending on the operating system, this can also cause KB5008353, see KB5008353 causes Windows Authentication connections to SQL Server to fail over VPN . Also KB4535996, see Windows 10: KB4535996 sorgt für Probleme bei VPN-Verbindungen (German article). <<< >>>
- MandatorAddressesSqlScript
MandatorAddressesSqlScript <<< Sage 100 Mandanten-Adressen / Mandator addresses' Sql Script (alle Versionen/all versions) Montag, 19. Juni 2023 Hintergrund/Background Im Sage ERP-System werden wichtige Grundfunktionen wie die Mandanten-Adresse, die Finanzamt-Adresse etc. im Adress-Stamm gespeichert. Dabei werden die Adressen mit einer Sonderfunktion markiert (Feld "KHKAdressen.Sondefunktion"). Um sich über die Adressen in der Datenbank, insbesondere bei mehreren Mandanten, einen schnellen Überblick zu verschaffen, kann das nachfolgende SQL-Script hilfreich sein. In the Sage ERP system, essential basic functions such as the mandator address, the tax office address , etc., are stored in the address master data section. Those addresses are marked with a special function (field "KHKAdressen.Sondefunktion"). The following SQL script can be helpful to get a quick overview of the addresses in the database, especially if there are several clients. SQL zum Abfragen der Mandanten-Adressen / SQL to query the mandator addresses SELECT A.Mandant ,M.Wert AS MandantBezeichnung ,A.Sonderfunktion ,CASE ISNULL(A.Sonderfunktion, 0) WHEN 1 THEN 'Mandant' WHEN 2 THEN 'Finanzamt' WHEN 4 THEN 'Steuerberater' WHEN 8 THEN 'Rechnungsempfänger Mandant' WHEN 9 THEN 'Mandant und Rechnungsempfänger Mandant' ELSE '(unbekannt)' END AS SonderfunktionZweck ,A.Adresse ,A.Matchcode ,A.Name1 ,A.LieferPlz ,A.LieferOrt FROM dbo.KHKAdressen AS A WITH (NOLOCK) INNER JOIN dbo.KHKMandanten AS M WITH (NOLOCK) ON A.Mandant = M.Mandant AND M.Eigenschaft = 1 WHERE ISNULL(A.Sonderfunktion, 0) > 0 ORDER BY A.Mandant ,A.Sonderfunktion <<< >>>
- MSAccessRemoval1
9.0.7 - Builds * - 2024 <<< Sage 100 - 9.0.7.x - Wegfall weiterer MS-Access-basierter Module/more MS-Access based modules will be removed 9.0.7 - Builds * - 2024 Wichtige MS-Access-basierte Module entfallen komplett / important MS-Access based modules will be removed completely Deutsch ⚠️Sage hat im Zusammenhang mit der geplanten Version 9.0. 7 .x angekündigt, dass einige wichtige MS-Access basierte Module vollständig entfernt werden.⚠️ Entfernung von MS-Access Dialogumschaltungen und MS-Access Formularen: Die Dialogumschaltung wird im Administrationsbereich für folgende Dialoge ab der Version 9.0.7 (Frühjahr 2024) nicht mehr möglich sein. Belegerfassung Verkauf - steht in neuer Technik seit Version 7.1 im Juni 2016 zur Verfügung Belegerfassung Einkauf - steht in neuer Technik seit Version 7.1 im Okt. 2016 zur Verfügung Stammdatendialog mit Artikel, Kunde, Lieferant und Textbausteinstammdaten - steht in neuer Technik seit Version 8.0 im April 2017 zur Verfügung Buchungserfassung - steht in neuer Technik seit Version 8.0 im Okt. 2017 zur Verfügung Lieferscheine erstellen - steht in neuer Technik seit Version 9.0 im Aug. 2022 zur Verfügung Die nachfolgenden MS-Access-basierten Fenster und Module werden in alter Technik ab der Version 9.0.7 ebenfalls nicht mehr zur Verfügung stehen: Zahlungen und Lastschriften Mahnwesen Großteil der Grundlagendialoge Projektstamm Lieferscheine erstellen Addin Intrastat Links <<< >>>
- UpdDevEx2
9.0.2 - Build 3752 - 12.05.2021 <<< Sage 100 - 9.0 - Update DevExpress -> Version 20.2.5 9.0.2 - Build 3752 - 12.05.2021 40774 Verbesserungen diverser UX/UI-Funktionen / Improvements to various UX/UI functions Deutsch DevExpress Bibliotheken wurden von Sage auf Version 20.2.5 aktualisiert. Bestehende eigene Lösungen, die diese Bibliotheken referenzieren, müssen i.d.R. neu compiliert werden. English DevExpress libraries have been updated to version 20.2.5 by Sage. Existing custom solutions that reference these libraries usually have to be recompiled. <<< >>>
- TaskInBackgroundConsoleExample
TaskInBackgroundConsoleExample <<< Aktion im Hintergrund ausführen / Execute action in background (alle Versionen/all versions) Mittwoch, 6. Mai 2026 Deutsch Hintergrund Häufig hat man in der Entwicklung die Situation , dass Routinen längere Laufzeiten haben. Schreibt man z.B. eine kleine Konsolen-Anwendung , die plötzlich eine länger laufende Methode aufruft , dann scheint die Anwendung zu stehen. Nachfolgend ein simpler Ansatz , der dem Anwender zumindest zeigt: Die Anwendung arbeitet noch! Code-Beispiel für eine Konsolen-Anwendung Mit "System.Threading.Tasks.Task.Run" kann man eine einzelne Methode (oder mehrere) recht einfach in einem Hintergrund-Task laufen lassen. Console.WriteLine( "Action started..." ); // Start the long-running operation in a background task var backgroundTask = System.Threading.Tasks.Task.Run( () => { ExecuteBulkUpsert( dataAccessor , tvpTable ); } ); // Main program loop, which waits for the background task to finish while ( !backgroundTask.IsCompleted ) { Console.WriteLine( "Be patient ... action is still running! " + DateTime.Now.ToString() ); System.Threading.Thread.Sleep( TimeSpan.FromSeconds( 2 ) ); } Console.WriteLine( "Action finished." ); <<< >>>
- AppDes15
9.0.6 - Build 7908 - 04.10.2023 <<< Sage 100 - 9.0.6.x - Umstellung AppDesigner-Verzeichnisstruktur 9.0.6 - Build 7908 - 04.10.2023 63296 Wichtige Änderungen Verzeichnisstruktur / Important changes directory structures Deutsch ⚠️ Um für AppDesigner-Metadaten-Lösungen GIT als Source-Control-System zu ermöglichen, wurde die Dateiablagestruktur der Metadaten umgestellt.⚠️ Jede Lösung befindet sich nun in einem eigenen Dateiverzeichnis. Durch diese Umstellung ist es nun einfach möglich, GIT einzusetzen. Sage hat in diesem Zusammenhang auch noch einmal klargestellt: Der AppDesigner selber schaut immer in den Unterordner "\Packages" des primären Applikationsservers. Ausschließlich die dortigen Xml-Dateien sind relevant, z.B. für den Abgleich mit der "OLGlobal"-Datenbank und anderen Maschinen! Unter Umständen wird Sage in zukünftigen Versionen diesbezüglich Änderungen vornehmen, um die GIT-Code Repository-Unterstützung zu verbessern (aktuell gibt es dort einige kleinere Probleme aufgrund der o.g. Vorgehensweise des AppDesigners). Siehe auch: www.officium-inservio.com AppDes16 9.0.6 - Build 7908 - 04.10.2023 <<< >>>
- FastFileHandlingExample
FastFileHandlingExample <<< Beispiel für schnelles Lesen und Schreiben von Dateien / Example of fast reading and writing of files (alle Versionen/all versions) Sonntag, 2. Juli 2023 Hintergrund / Background Code Parameters Main file access code Hintergrund / Background Bei der Verarbeitung von sehr großen Dateien kommt es auf Geschwindigkeit an. Es empfiehlt sich, direkt mit den System.IO-Klassen "FileStream" , "StreamReader" und "StreamWriter" zu arbeiten. Im vorliegenden Anwendungsfall musste ein Konvertierungsprogramm erstellt werden, welches Dateien, die nicht 100% im CSV-Format vorlagen, in ein korrektes CSV-Format überführt. When processing very large files , speed is of the essence. It's a good idea to work directly with the System.IO "FileStream" , "StreamReader" , and "StreamWriter" classes. In the present application, a conversion program had to be created that converts files that were not 100% in CSV format into the correct CSV format. Code Parameters /// Required: The source file name. /// Required: The target file name. /// Required: The general file encoding. /// Required: The character which indicates the end of line. /// Required: The character which indicates a field separation. /// Required: The character which is used for field quotations. Will be removed for by this method. /// Required: The maximum required field count by the target additional programming. The will have only this maximum amount of data columns. string sourceFileName;, string targetFileName; System.Text.Encoding fileEncoding; string targetFileEndOfLineCharacter; string fieldSeparationCharacter; string fieldQuotationCharacter; int requiredMaxFieldCount; Main file access code var bufferSize = 64 * 1024; -- TODO: Can be adjusted to your needs! var textHelperSourceLine = new System.Text.StringBuilder(); using ( var sourceFileStream = new System.IO.FileStream( sourceFileName , System.IO.FileMode.Open , System.IO.FileAccess.Read , System.IO.FileShare.None , bufferSize , System.IO.FileOptions.SequentialScan ) ) using ( var sourceFileReader = new System.IO.StreamReader( sourceFileStream , fileEncoding ) ) -- Note, there is a file mode to append to existing files also! using ( var targetFileStream = new System.IO.FileStream( targetFileName , System.IO.FileMode.CreateNew , System.IO.FileAccess.Write , System.IO.FileShare.None , bufferSize , System.IO.FileOptions.WriteThrough ) ) using ( var targetFileWriter = new System.IO.StreamWriter( targetFileStream , fileEncoding ) ) { while ( sourceFileReader.Peek() >= 0 ) { -- TODO: Please note that this approach is only suitable in this special use case for our project! -- It depends on your own project how to convert the source data! textHelperSourceLine.Clear(); textHelperSourceLine.Append( sourceFileReader.ReadLine().Replace( fieldQuotationCharacter , string.Empty ) ); var textColumns = textHelperSourceLine.ToString().Split( fieldSeparationCharacter.ToCharArray() ); textHelperSourceLine.Clear(); for ( int i = 0 ; i < requiredMaxFieldCount ; i++ ) { if ( i > 0 ) targetFileWriter.Write( fieldSeparationCharacter ); if ( i < textColumns.Length ) { targetFileWriter.Write( textColumns[i] ); } } targetFileWriter.Write( targetFileEndOfLineCharacter ); } } <<< >>>
- SageApiCreateDocumentation
SageApiCreateDocumentation <<< Sage API Dokumentation aus AppDesigner erzeugen / Create Sage API documentation from AppDesigner 9.0.x Freitag, 11. September 2026 Deutsch Hintergrund Voraussetzungen Aufruf der Funktion Deutsch Hintergrund Im Sage AppDesigner kann man sich Sage API-Endpunkte erstellen (entsprechende Lizenz vorausgesetzt). Es stellt sich die Frage , wie man diese Endpunkte möglichst elegant direkt aus dem AppDesigner heraus dokumentieren kann. Es springt die Funktion "API-Dokumentation erzeugen" sofort ins Auge , die aber gewisse Lizenz- und Setup-Voraussetzungen mit sich bringt . Ansicht des Kontextmenüs "API-Dokumentation erzeugen" per rechter Maustaste auf einer AppDesigner-Lösung. Voraussetzungen Wesentliche Voraussetzung ist eine Sage Entwicklerlizenz. Darüber hinaus muss dass SDK Entwickler-Setup von Sage mit nachfolgenden Optionen installiert werden. Ansicht des SDK-Setups und der notwendigen Optionen , die für die API-Dokumentation sinnvoll und erforderlich sind. ⚠️Dieses Setup wird in der aktuellsten Version von Sage grundsätzlich im Anschluss an die jährliche Sage Developer Konferenz für Partner veröffentlicht , die entsprechende Verträge mit Sage abgeschlossen haben. Aufruf der Funktion Sobald alle Voraussetzungen erfüllt sind , kann man die Funktion "API-Dokumentation erzeugen" auf der entsprechenden AppDesigner-Lösung starten. Ansicht der Optionen für das Erzeugen der API-Dokumentation. Der erste Punkt "OpenAPI Dokumentation erzeugen" erstellt eine Datei namens " ApiDoc.json ". Standardmäßig hat diese Datei eine proprietäre Struktur. Man kann diese Datei daher nicht direkt in Swagger, Postman oder anderen gängigen API-Lifecycle-Tools verwenden. Die Datei enthält jedoch alle erforderlichen architektonischen Daten, wie zum Beispiel Felddatentypen, ob Felder Pflichtfelder sind und ob sie schreibgeschützt sind. Die Datei eignet sich somit als gute Basis für eine Dokumentation! Das Erstellen der C# Client Klassen ist eine nützliche Hilfestellung und basiert auf diversen Sage Vorlagen. Selbstverständlich hängt es vom Projekt ab , inwieweit dies sinnvoll ist und inwieweit eine Nacharbeitung des Quellcodes notwendig ist. Grundsätzlich ist die Sage API nutzbar , sobald die Endpunkte im Sage Applikationsserver veröffentlicht wurden - ein Neustart des Sage Applikationsservers ist dazu zwingend notwendig! <<< >>>
- SqlMassMergeImport
SqlMassMergeImport <<< Performanter Bulk-MERGE tausender Datensätze / performant bulk merge of thousands of records (alle Versionen/all versions) Donnerstag, 12. März 2026 Deutsch Hintergrund Beispiel SQL-Tabelle als Ausgangssituation Anlage eines benutzerdefinierten SQL-Tabellen-Typ Anlage einer SQL-Datenbankprozedur für den MERGE .net-Implementierung mittels "System.Data.DataTable" Ausführung der Datenbankprozedur English Background Example SQL table as initial situation Creation of a user-defined SQL table type Creation of an SQL stored procedure for the MERGE .net implementation using "System.Data.DataTable" Executing the stored procedure from .net Deutsch Hintergrund Man möchte massenhaft Daten möglichst schnell in den Microsoft SQL-Server in eine Tabelle importieren. Dabei gibt es jedoch die Besonderheit , dass ein MERGE stattfinden muss , d.h. ein simples "berühmtes" BULK-INSERT ist ausgeschlossen. Es muss für jeden Datensatz effizient geprüft werden , ob dieser schon existiert oder nicht. Dennoch sollen möglichst alle Daten effizient und schnell von dem lokalen Client per SQL in den SQL-Server "wandern". Nachfolgender Lösungsansatz ist leicht zu verstehen und dennoch extrem performant. Tipp: Siehe auch https://www.officium-inservio.com/ms-net-1/sqlrecordsmassupdate für das Massen-Aktualisieren von Datensätzen. Beispiel SQL-Tabelle als Ausgangssituation Nachfolgende Tabelle hat einen massiven zusammengesetzten Schlüssel und soll mit zig Tausenden von Metadaten aus einer lokalen Quelle auf einem Client aktualisiert werden. Bei bestehenden Datensätzen muss lediglich ein Info-Feld aktualisiert werden (UPDATE) Bei komplett neuen Datensätzen (die neue Metadaten bedeuten) muss jedoch ein neuer Datensatz angelegt werden (INSERT). CREATE TABLE [dbo].[SAGPASoftwareProductsMetaDataFields] ( [IDSoftwareProduct] [binary](100) NOT NULL, [IDSoftwareProductString] AS (('{'+CONVERT([nvarchar](100),CONVERT([uniqueidentifier],[IDSoftwareProduct],(0)),(0)))+'}'), [SoftwareProductContextId] [int] NOT NULL, [SoftwareProductVersionMajor] [int] NOT NULL, [SoftwareProductVersionMinor] [int] NOT NULL, [SoftwareProductVersionRevision] [int] NOT NULL, [TableName] [nvarchar](128) NOT NULL, [FieldName] [nvarchar](128) NOT NULL, [FieldTypeInformation] [nvarchar](255) NULL, [FieldDetails] [nvarchar](max) NULL, [FieldDetailsPlainText] [nvarchar](max) NULL, [FieldDetailsVendor] [nvarchar](max) NULL, [TableNameInfo] [nvarchar](255) NULL, [FieldNameInfo] [nvarchar](255) NULL, [FieldDefaultDataSourceName] [nvarchar](200) NULL,[CreatedOn] [datetime] NULL, [CreatedBy] [nvarchar](128) NULL, [UpdatedOn] [datetime] NULL, [UpdatedBy] [nvarchar](128) NULL, CONSTRAINT [PK_SAGPAProductMetaDataFields] PRIMARY KEY CLUSTERED ( [IDSoftwareProduct] ASC, [SoftwareProductContextId] ASC, [SoftwareProductVersionMajor] ASC,[SoftwareProductVersionMinor] ASC, [SoftwareProductVersionRevision] ASC, [TableName] ASC, [FieldName] ASC ) WITH ( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF ) ON [PRIMARY] ) ON [PRIMARY] GO Anlage eines benutzerdefinierten SQL-Tabellen-Typ Man legt sich nun einen benutzerdefinierten SQL-Tabellen-Typ an , der genau die relevanten Felder beinhaltet , die bei der Massenaktion behandelt werden sollen. CREATE TYPE [dbo].[utSAGTbl_MetaDataFields] AS TABLE ( [IDSoftwareProduct] BINARY(100) NOT NULL, [SoftwareProductContextId] INT NOT NULL, [SoftwareProductVersionMajor] INT NOT NULL, [SoftwareProductVersionMinor] INT NOT NULL, [SoftwareProductVersionRevision] INT NOT NULL, [TableName] NVARCHAR(128) NOT NULL, [FieldName] NVARCHAR(128) NOT NULL, [FieldTypeInformation] NVARCHAR(255) NULL, [FieldDetails] NVARCHAR(MAX) NULL, [FieldDetailsVendor] NVARCHAR(MAX) NULL, [FieldDefaultDataSourceName] NVARCHAR(MAX) NULL ) Anlage einer SQL-Datenbankprozedur für den MERGE Eine simple SQL-Datenbankprozedur macht dann später die eigentliche Massenarbeit auf dem MS-SQL-Server. Dadurch wird maximale Performance möglich , indem der SQL-Befehl "MERGE" benutzt wird. Dieser erlaubt genau die Unterscheidung zwischen den beiden Fällen , ob ein Datensatz neu ist (INSERT nötig) oder bereits existiert (UPDATE nötig). Einfacher geht es nicht! CREATE PROCEDURE [dbo].[spSAGInsertOrUpdatePASoftwareProductsMetaDataFields] @tblFields [dbo].[utSAGTbl_MetaDataFields] READONLY AS BEGIN -- Mass import and update of metadata in "SAGPASoftwareProductsMetaDataFields" ! SET NOCOUNT ON MERGE [dbo].[SAGPASoftwareProductsMetaDataFields] AS Target USING @tblFields AS Source ON Target.[IDSoftwareProduct] = Source.IDSoftwareProduct] AND Target.[SoftwareProductContextId] = Source.[SoftwareProductContextId] AND Target.[SoftwareProductVersionMajor] = Source.[SoftwareProductVersionMajor] AND Target.[SoftwareProductVersionMinor] = Source.[SoftwareProductVersionMinor] AND Target.[TableName] = Source.[TableName] AND Target.[FieldName] = Source.[FieldName] WHEN MATCHED THEN UPDATE SET [FieldTypeInformation] = Source.[FieldTypeInformation] WHEN NOT MATCHED BY TARGET THEN INSERT ( [IDSoftwareProduct], [SoftwareProductContextId], SoftwareProductVersionMajor], [SoftwareProductVersionMinor], [SoftwareProductVersionRevision], [TableName], [FieldName], [FieldTypeInformation], [FieldDetails], [FieldDetailsVendor], [FieldDefaultDataSourceName] ) VALUES ( Source.[IDSoftwareProduct], Source.[SoftwareProductContextId], Source.[SoftwareProductVersionMajor], Source.[SoftwareProductVersionMinor], Source.[SoftwareProductVersionRevision], Source.[TableName], Source.[FieldName], Source.[FieldTypeInformation], Source.[FieldDetails], Source.[FieldDetailsVendor], Source.[FieldDefaultDataSourceName] ); END ⚠️Auffällig ist dabei , dass eben als Parameter für die Datenbankprozedur der benutzerdefinierte Tabellen-Typ "utSAGTbl_MetaDataFields" erwartet wird und übergeben werden kann. Dies ist der entscheidende Faktor , da somit mit einem einzigen Aufruf der Prozedur alle x tausend Datensätze übergeben werden können. .net-Implementierung mittels "System.Data.DataTable" Die Implementierung auf der .net-Seite ist extrem einfach! Man sammelt sich alle Daten performant in einer großen Tabelle des Typs "System.Data.DataTable". Das Praktische: Diese gesamte Tabelle kann man "in einem Rutsch" an die zuvor genannte Datenbankprozedur übergeben! Im konkreten Anwendungsfall wurden 30.000 Datenfeld-Informationen mit einer simplen Schleife auf dem lokalen PC auf der Basis von bereits extrahierten Text-Metadaten ermittelt und zusammengetragen. Beispiel für einen Datensatz: var dt = new System.Data.DataTable(); dt.Columns.Add( "IDSoftwareProduct" , typeof( byte[] ) ); dt.Columns.Add( "SoftwareProductContextId" , typeof( int ) ); dt.Columns.Add( "SoftwareProductVersionMajor" , typeof( int ) ); dt.Columns.Add( "SoftwareProductVersionMinor" , typeof( int ) ); dt.Columns.Add( "SoftwareProductVersionRevision" , typeof( int ) ); dt.Columns.Add( "TableName" , typeof( string ) ); dt.Columns.Add( "FieldName" , typeof( string ) ); dt.Columns.Add( "FieldTypeInformation" , typeof( string ) ); dt.Columns.Add( "FieldDetails" , typeof( string ) ); dt.Columns.Add( "FieldDetailsVendor" , typeof( string ) ); dt.Columns.Add( "FieldDefaultDataSourceName" , typeof( string ) ); ... dt.Rows.Add( softwareProductId , softwareProductContextId , targetErpVersionMajor , targetErpVersionMinor , targetErpVersionRevision , tableDef.Name , fieldDef.Name , fieldTypeInfoHelper.ToString() , fieldDef.Description.ToStringEnhanced().Trim() , string.Empty , string.Empty ); ... Ausführung der Datenbankprozedur Ausführen der Datenbankprozedur aus .net Es gilt die übliche Vorgehensweise. Man benötigt eine SQL-Verbindung und ruft dann entsprechend die Datenbankprozedur auf. Im vorliegenden Fall wurde als Technologie "System.Data.SqlClient" gewählt. Dabei kommt uns zu Hilfe , dass "System.Data.SqlClient.SqlCommand" es erlaubt , auch eigene benutzerdefinierte Typen zu übergeben. Einzige Voraussetzung ist , dass man den passenden "SqlDbType" verwendet. Dies ist "System.Data.SqlDbType.Structured". Außerdem muss man zwingend den Typen-Namen mitgeben (am besten voll-qualifiziert) , damit der SQL-Server das Ganze auflösen kann. Das Ergebnis ist simplel und beeindruckend. Die 30.000 Datensätze wurden innerhalb von Sekunden vollständig vom SQL-Server verarbeitet! Hätte man sich für eine imperative Iteration entschieden , die jeden Datensatz einzeln vom Client zum Server sendet , wäre die Laufzeit extrem länger. using ( var cmd = new System.Data.SqlClient.SqlCommand( "spSAGInsertOrUpdatePASoftwareProductsMetaDataFields" , sqlConnection ) ) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = TimeSpan.FromMinutes( 30 ).TotalSeconds.ToInt32(); var tvpParam = cmd.Parameters.AddWithValue( "@tblFields" , tvpTable ); tvpParam.SqlDbType = System.Data.SqlDbType.Structured; tvpParam.TypeName = "dbo.utSAGTbl_MetaDataFields"; // Important: You must set the type here! cmd.ExecuteNonQuery(); } English Background One wants to import a massive amount of data as quickly as possible into a Microsoft SQL Server table. However, there is the special requirement that a MERGE must take place, i.e. a simple "famous" BULK INSERT is ruled out. It must be efficiently checked for each data record whether it already exists or not. Nevertheless, ideally all data should "migrate" efficiently and quickly from the local client to the SQL Server via SQL. The following approach is easy to understand and yet extremely performant. Tip: See also https://www.officium-inservio.com/ms-net-1/sqlrecordsmassupdate for bulk updating of records. Example SQL table as initial situation The following table has a massive composite key and is to be updated with tens of thousands of metadata records from a local source on a client. For existing data records, only an info field needs to be updated (UPDATE). For completely new data records (which mean new metadata), however, a new data record must be created (INSERT). CREATE TABLE [dbo].[SAGPASoftwareProductsMetaDataFields] ( [IDSoftwareProduct] [binary](100) NOT NULL, [IDSoftwareProductString] AS (('{'+CONVERT([nvarchar](100),CONVERT([uniqueidentifier],[IDSoftwareProduct],(0)),(0)))+'}'), [SoftwareProductContextId] [int] NOT NULL, [SoftwareProductVersionMajor] [int] NOT NULL, [SoftwareProductVersionMinor] [int] NOT NULL, [SoftwareProductVersionRevision] [int] NOT NULL, [TableName] [nvarchar](128) NOT NULL, [FieldName] [nvarchar](128) NOT NULL, [FieldTypeInformation] [nvarchar](255) NULL, [FieldDetails] [nvarchar](max) NULL, [FieldDetailsPlainText] [nvarchar](max) NULL, [FieldDetailsVendor] [nvarchar](max) NULL, [TableNameInfo] [nvarchar](255) NULL, [FieldNameInfo] [nvarchar](255) NULL, [FieldDefaultDataSourceName] [nvarchar](200) NULL,[CreatedOn] [datetime] NULL, [CreatedBy] [nvarchar](128) NULL, [UpdatedOn] [datetime] NULL, [UpdatedBy] [nvarchar](128) NULL, CONSTRAINT [PK_SAGPAProductMetaDataFields] PRIMARY KEY CLUSTERED ( [IDSoftwareProduct] ASC, [SoftwareProductContextId] ASC, [SoftwareProductVersionMajor] ASC,[SoftwareProductVersionMinor] ASC, [SoftwareProductVersionRevision] ASC, [TableName] ASC, [FieldName] ASC ) WITH ( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF ) ON [PRIMARY] ) ON [PRIMARY] GO Creation of a user-defined SQL table type One now creates a user-defined SQL table type, which contains exactly the relevant fields. CREATE TYPE [dbo].[utSAGTbl_MetaDataFields] AS TABLE ( [IDSoftwareProduct] BINARY(100) NOT NULL, [SoftwareProductContextId] INT NOT NULL, [SoftwareProductVersionMajor] INT NOT NULL, [SoftwareProductVersionMinor] INT NOT NULL, [SoftwareProductVersionRevision] INT NOT NULL, [TableName] NVARCHAR(128) NOT NULL, [FieldName] NVARCHAR(128) NOT NULL, [FieldTypeInformation] NVARCHAR(255) NULL, [FieldDetails] NVARCHAR(MAX) NULL, [FieldDetailsVendor] NVARCHAR(MAX) NULL, [FieldDefaultDataSourceName] NVARCHAR(MAX) NULL ) Creation of an SQL stored procedure for the MERGE A simple SQL stored procedure does the actual bulk work on the SQL Server. CREATE PROCEDURE [dbo].[spSAGInsertOrUpdatePASoftwareProductsMetaDataFields] @tblFields [dbo].[utSAGTbl_MetaDataFields] READONLY AS BEGIN -- Mass import and update of metadata in "SAGPASoftwareProductsMetaDataFields" ! SET NOCOUNT ON MERGE [dbo].[SAGPASoftwareProductsMetaDataFields] AS Target USING @tblFields AS Source ON Target.[IDSoftwareProduct] = Source.IDSoftwareProduct] AND Target.[SoftwareProductContextId] = Source.[SoftwareProductContextId] AND Target.[SoftwareProductVersionMajor] = Source.[SoftwareProductVersionMajor] AND Target.[SoftwareProductVersionMinor] = Source.[SoftwareProductVersionMinor] AND Target.[TableName] = Source.[TableName] AND Target.[FieldName] = Source.[FieldName] WHEN MATCHED THEN UPDATE SET [FieldTypeInformation] = Source.[FieldTypeInformation] WHEN NOT MATCHED BY TARGET THEN INSERT ( [IDSoftwareProduct], [SoftwareProductContextId], SoftwareProductVersionMajor], [SoftwareProductVersionMinor], [SoftwareProductVersionRevision], [TableName], [FieldName], [FieldTypeInformation], [FieldDetails], [FieldDetailsVendor], [FieldDefaultDataSourceName] ) VALUES ( Source.[IDSoftwareProduct], Source.[SoftwareProductContextId], Source.[SoftwareProductVersionMajor], Source.[SoftwareProductVersionMinor], Source.[SoftwareProductVersionRevision], Source.[TableName], Source.[FieldName], Source.[FieldTypeInformation], Source.[FieldDetails], Source.[FieldDetailsVendor], Source.[FieldDefaultDataSourceName] ); END ⚠️What is noticeable here is that the user-defined table type "utSAGTbl_MetaDataFields" is expected exactly as a parameter for the stored procedure. .net implementation using "System.Data.DataTable" The implementation on the .net side is extremely simple! One collects all data performantly in a large table of the type "System.Data.DataTable". The practical part: This entire table can be passed "in one go" to the aforementioned stored procedure! In the specific use case, 30,000 data field records were determined and compiled with a simple loop on the local PC based on previously extracted text metadata. Example for a data record: var dt = new System.Data.DataTable(); dt.Columns.Add( "IDSoftwareProduct" , typeof( byte[] ) ); dt.Columns.Add( "SoftwareProductContextId" , typeof( int ) ); dt.Columns.Add( "SoftwareProductVersionMajor" , typeof( int ) ); dt.Columns.Add( "SoftwareProductVersionMinor" , typeof( int ) ); dt.Columns.Add( "SoftwareProductVersionRevision" , typeof( int ) ); dt.Columns.Add( "TableName" , typeof( string ) ); dt.Columns.Add( "FieldName" , typeof( string ) ); dt.Columns.Add( "FieldTypeInformation" , typeof( string ) ); dt.Columns.Add( "FieldDetails" , typeof( string ) ); dt.Columns.Add( "FieldDetailsVendor" , typeof( string ) ); dt.Columns.Add( "FieldDefaultDataSourceName" , typeof( string ) ); ... dt.Rows.Add( softwareProductId , softwareProductContextId , targetErpVersionMajor , targetErpVersionMinor , targetErpVersionRevision , tableDef.Name , fieldDef.Name , fieldTypeInfoHelper.ToString() , fieldDef.Description.ToStringEnhanced().Trim() , string.Empty , string.Empty ); ... Executing the stored procedure from .net The usual procedure applies. One needs an SQL connection and then calls the stored procedure accordingly. In the present case, "System.Data.SqlClient" was chosen as the technology. It comes to our aid here that "System.Data.SqlClient.SqlCommand" allows passing custom user-defined types as well. The only prerequisite is that one uses the appropriate "SqlDbType". This is "System.Data.SqlDbType.Structured". Furthermore, one must strictly provide the type name (ideally fully qualified), so that the SQL Server can resolve the whole thing. The result is simple and impressive. The 30,000 data records were completely processed by the SQL Server within seconds! Had one opted for an imperative iteration, which sends each data record individually from the client to the server, the runtime would have been extremely longer. using ( var cmd = new System.Data.SqlClient.SqlCommand( "spSAGInsertOrUpdatePASoftwareProductsMetaDataFields" , sqlConnection ) ) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = TimeSpan.FromMinutes( 30 ).TotalSeconds.ToInt32(); var tvpParam = cmd.Parameters.AddWithValue( "@tblFields" , tvpTable ); tvpParam.SqlDbType = System.Data.SqlDbType.Structured; tvpParam.TypeName = "dbo.utSAGTbl_MetaDataFields"; // Important: You must set the type here! cmd.ExecuteNonQuery(); } <<< >>>
- Db3
8.1.2 - Build 2159 - 17.09.2019 <<< Sage 100 - 8.1 - Database - xRM Belegkennzeichen / Sage 100 xRM document types 8.1.2 - Build 2159 - 17.09.2019 xRM Belegkennzeichen geändert / xRM document types changed Siehe / see https://www.officium-inservio.com/sage-100-1/xrmdbdoctypes <<< >>>
- Db1
9.0.1 - Build 2233 - 16.11.2020 <<< Sage 100 - 9.0 - Database - Datentyp "Text" / data type "text" 9.0.1 - Build 2233 - 16.11.2020 38805 Umstellung SQL-Datentyp "Text" auf "Varchar(Max)" / Change of SQL data type "Text" to "Varchar(Max)" Deutsch Microsoft kündigt schon seit einiger Zeit an, dass der SQL-Datentyp "Text" in einer zukünftigen Version des SQL-Servers entfernt werden soll und stattdessen "Varchar(Max)" genutzt werden soll. Daher wurde die Sage 100 Standardelemente nun auf den neuen Datentyp umgestellt. Dies bedeutet, dass neu angelegte Datenbanken den SQL-Datentyp "Varchar(Max)" nutzen. Bestehende Mandanten-Datenbanken und die globale Datenbank werden beim Update auf Version 9.0.1 automatisch auf den neuen SQL-Datentyp umgestellt. Da auch die globale Datenbank umgestellt wird, kann einer globale Datenbank, die mit Version 9.0.1 oder neuer genutzt wird, nicht mehr gleichzeitig von älteren Versionen genutzt werden. Diese Doppelnutzung war bisher erlaubt und wurde insb. in Testumgebungen genutzt. Erforderliche Aktionen: Für Version 9.0.1 müssen die Mandanten-Datenbanken und die globale Datenbank aktualisiert werden. Partner-/Kunden-Applikationen sollten ebenfalls den neuen Datentyp benutzen. Hierfür sind in den Datenbanken Tabellenfelder, gespeicherte Prozeduren und Trigger umzustellen. Die Umstellung muss nicht sofort erfolgen. Aktuell unterstützt sowohl der Microsoft SQL-Server als auch der Code der Sage 100 weiterhin auch den SQL-Datentyp "Text". Eine Umstellung ist aber einzuplanen (die Umstellung der Tabellenfeld kann problemlos über den TSQL-Befehl "ALTER COLUMN" erfolgen). Beispiel T-SQL-Script siehe hier: https://www.officium-inservio.com/ms-sql/autoconvtext English Microsoft has announced for some time that the SQL data type "Text" will be removed in a future version of SQL Server, and "Varchar(Max)" will be used instead. Therefore, the Sage 100 standard elements in the database have now been converted to the new data type. This means that newly created databases use the SQL data type "Varchar(Max)". Existing client databases and the global database are automatically converted to the new SQL data type when updating to version 9.0.1. Since the global database is also being converted, a global database with version 9.0.1 or newer can no longer be used simultaneously by older versions. This dual use was previously permitted and often used in test environments. Required actions: For version 9.0.1, the mandator databases and the global database must be updated. Partner/customer applications should also use the new data type. For this purpose, table fields, stored procedures and triggers must be converted in the databases. The change does not have to be immediate. Currently, both the Microsoft SQL Server and the code of the Sage 100 continue to support the SQL data type "Text". However, a conversion must be planned (the conversion of the table field can be done easily using the TSQL command "ALTER COLUMN"). See this exampke T-SQL-Script: https://www.officium-inservio.com/ms-sql/autoconvtext <<< >>>
