diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5914463 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Verwendet IntelliSense zum Ermitteln möglicher Attribute. + // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. + // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "PowerShell: Launch Current File", + "type": "PowerShell", + "request": "launch", + "script": "${file}", + "args": [] + } + ] +} \ No newline at end of file diff --git a/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database.ps1 b/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database.ps1 deleted file mode 100644 index d563fe5..0000000 Binary files a/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database.ps1 and /dev/null differ diff --git a/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database_History.txt b/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database_History.txt deleted file mode 100644 index 27039ce..0000000 --- a/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database_History.txt +++ /dev/null @@ -1,15 +0,0 @@ - -------------------------------------------------------------------------------- - -Version 1.0.0.0 - 15.10.2018 -NEW: - -FIX: - -CHG: - -REM: - - --------------------------------------legend------------------------------------ -NEW: = Added a new functionality -FIX: = Fixed a Issue with existing functionality -CHG: = Changed a existing functionality -REM: = Removed a functionality -------------------------------------------------------------------------------- \ No newline at end of file diff --git a/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database_Settings.ini b/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database_Settings.ini deleted file mode 100644 index b1a77c1..0000000 --- a/current/Import-FileContentToDB/Archiv/1.0.0.0/Import-FileContent2Database_Settings.ini +++ /dev/null @@ -1,156 +0,0 @@ -#################################################################################################### -# Digital Data Configuration File (Template Date: 30.07.2016) # -# UTF-8 Coding required! # -# incl. FailSafe functions that are active when information is missing. # -#################################################################################################### - -#==================================================================================================# -########################################## General Setup ########################################### -#==================================================================================================# - -#################################################################################################### -# Path in which the log files will be stored. # -# Example: E:\LogFiles\ # -# FailSafe Setting is: \Logs # -#################################################################################################### -LogPath = - -#################################################################################################### -# Numerical value how long (in days) log files will be kept. ValidateRange is 0 - 1000 # -# Setting the Value to 0 disables this Function. # -# FailSafe Setting is: 60 # -#################################################################################################### -LogFileKeepTime = 30 - -#################################################################################################### -# Numerical value how long (in Minutes) a File has to be there, before processing it. # -# FailSafe Setting is: 5 # -#################################################################################################### -FileDelayAge = 1 - -#==================================================================================================# -######################################## Database settings ######################################## -#==================================================================================================# - -#################################################################################################### -# Name or IP-Adress of the Database Server. # -# Example: 192.168.0.1 # -# Example: 192.168.0.1\ # -#################################################################################################### -DBSQLConnectServer = 172.24.12.56 - -#################################################################################################### -# UserName for the SQL Connection. # -# This Setting is not neccessary if DBSQLConnectIntegratedSecurity is set to "true". # -# Example: sa # -#################################################################################################### -DBSQLConnectUserName = sa - -#################################################################################################### -# Password for the specified UserName you set before. # -# This Setting is not neccessary if DBSQLConnectIntegratedSecurity is set to "true". # -#################################################################################################### -DBSQLConnectUserPassword = dd - -#################################################################################################### -# Set the Database Name which exists on the Database Server. # -# Example: windream60 # -#################################################################################################### -DBSQLConnectDatabase = CWLDATEN - -#################################################################################################### -# Set this to "True" if the Windows Login credentials should be used of Database Login. # -# In this case DBSQLConnectUserName and DBSQLConnectUserPassword setting will be ignored! # -# Example: True # -# Example: False # -#################################################################################################### -DBSQLConnectIntegratedSecurity = false - -#==================================================================================================# -########################################## Profile Setup ########################################### -#==================================================================================================# - -#################################################################################################### -# In the following section(s), it is possible to use multiple variables in File and Folder Paths, # -# in SQL Statements as well and other data related specifications. # -# # -# = # -# %USERNAME% = The current User Name running this Script # -# %USERDOMAIN% = The current Domain Name, User is logged on # -# %COMPUTERNAME% = The Computername on which this Script is running # -# %LOGONSERVER% = The currently connected Domain Controller # -# %SCAN%& = Scan Tag for Batch scanning, will be replaced with - nothing # -# %DATE% = Get Date in this Format: dd.MM.yyyy # -# %TIMESTAMP1% = Get Date in this Format: ddMMyyyy # -# %TIMESTAMP2% = Get Date and Time in this Format: ddMMyyyy_HHmmss # -# %TIMESTAMP3% = Get Date and Time in this Format: ddMMyyyy_HHmmssffff # -# %TIMESTAMP4% = Get Date and Time in this Format: yyyyMMdd HHmmssfff # -# %TIMESTAMP5% = Get Date and Time in this Format: yyyyMMdd_HHmmss # -# %TIMESTAMP6% = Get Date in this Format: dd.MM.yyyy # -# %TIMESTAMP7% = Get Date and Time in this Format: dd.MM.yyyy_HH:mm:ss # -# %TIMESTAMP8% = Get Date and Time in this Format: dd.MM.yyyy_HH:mm:ss.ffff # -# %TIMESTAMP9% = Get Date and Time in this Format: yyyy/MM/dd HH:mm:ss.fff # -# %TIMESTAMP10% = Get Date and Time in this Format: yyyy/MM/dd HH:mm:ss # -#--------------------------------------------------------------------------------------------------# -# Additional Variables specific for this Script are: # -# %SourceFile% = Name of the processed File, including its Extension # -# %SourceFilePath% = Directory of the processed File # -# %SourceFileFullName% = Directory and Name of the processed File, including its Extension # -# # -# This dump table is matching with Function: "Update-ReplacePlaceholder-withLogging" # -# Version Number: 1.0.0.0 / Version Date: 25.10.2018 # -#################################################################################################### - -#################################################################################################### -# Define Profiles in this config file for the executing Script. # -# Syntax: # -# Profile = ; ; ; ; ; # -# ; ; # -# Example: # -# Profile = BulkImport ; e:\SourceFile.csv # -# Profile_CheckSQLQuery = SQL Statements (SELECT) -# Profile_InitialSQLQuery = SQL Statements (SELECT, INSERT, UPDATE) -# Profile_PreparingSQLQuery = SQL Statements (SELECT, INSERT, UPDATE) -# Profile_MainLoopSQLQuery = SQL Statements (INSERT, UPDATE) -# Profile_FinalSQLQuery = SQL Statements (SELECT, INSERT, UPDATE) -#--------------------------------------------------------------------------------------------------# -# First Parameter: # -# Set the way, Script is reading the SourceFile. # -# Currently only the BulkImport is available. # -# Example: BulkImport # -#--------------------------------------------------------------------------------------------------# -# Second Parameter: # -# Set the full path and name to the file which includes the list you want to Import. # -# Make sure, file is .csv and value separation is done by ";". # -# Example: E:\UserList.csv # -#--------------------------------------------------------------------------------------------------# -# Optional Parameter: %ImportPathAD=,, # -# Determ the TargetPath in your Active Directory (part of the distinguishedName). # -# If you dont use this Parameter, TargetPath will be the "Users" Folder by default. # -# Example: OU=Testuser,DC=domainname,DC=local # -#--------------------------------------------------------------------------------------------------# -# Optional Parameter: %ReportFile=\.csv # -# By setting this Parameter, you get a overview file, which includes every created User, # -# with all available data (UserName, PreName, Surname, Password ...) # -# Example: %ReportFile=E:\ReportFile.csv # -#--------------------------------------------------------------------------------------------------# -# Argument call: # -# If you need to run the Script with dynamic Values, you can do so, by calling it with arguments. # -# Even the Special and Optional Parameters are available in this case. # -# Example: # -# This Function is currently not implement! # -#################################################################################################### - -Profile = BulkImport ; %ColumnName%|%CellValue% ; P:\Skriptentwickung\development\Import-CSV2DB\test-dateien\AltesFormat\*.txt ; 1 ; 2 ; . ;%SourceFilePath%\Archiv\%Timestamp5% ; %SourceFilePath%\Error -Profile_CheckSQLQuery = SELECT 'true' -Profile_InitialSQLQuery = SELECT (SELECT [u003] FROM [CWLDATEN].[dbo].[t693] WHERE [u000] = 1)+1 -Profile_PreparingSQLQuery = INSERT INTO [CWLDATEN].[dbo].[TBDD_BATCHIMPORT_HEAD] (BELEGKEY, Konto, Laufnummer, Auftragsnummer) VALUES (%InitialSQLResult%, '700131', NULL, NULL) UPDATE [CWLDATEN].[dbo].[t693] SET u003 = %InitialSQLResult% WHERE [u000] = 1 -Profile_MainLoopSQLQuery = INSERT INTO [CWLDATEN].[dbo].[t699] (u000, u001, u002, u003, u004, u005, u006, u007, u008, u009, u010, u011, u012, u013, u014, u015, u016, u029, u030) Select ISNULL(MAX(u000),0) + 1, %InitialSQLResult%, '%sourcefile%', '%column3%', '%column1%', '%column2%', '%column3%', '%column4%', '%column5%', '%column6%', '%column7%', '%column8%', '%column9%', '%column10%', '%column11%', '%column12%', '%column13%', getdate(), '%username%' FROM [CWLDATEN].[dbo].[t699] -Profile_FinalSQLQuery = - - - - - - - diff --git a/current/Import-FileContentToDB/Import-FileContentToDB.ps1 b/current/Import-FileContentToDB/Import-FileContentToDB.ps1 index 84dbbd3..cd29498 100644 Binary files a/current/Import-FileContentToDB/Import-FileContentToDB.ps1 and b/current/Import-FileContentToDB/Import-FileContentToDB.ps1 differ diff --git a/current/Import-FileContentToDB/Import-FileContentToDB_Settings - Kopie.ini b/current/Import-FileContentToDB/Import-FileContentToDB_Settings - Kopie.ini deleted file mode 100644 index 4271def..0000000 --- a/current/Import-FileContentToDB/Import-FileContentToDB_Settings - Kopie.ini +++ /dev/null @@ -1,144 +0,0 @@ -#################################################################################################### -# Digital Data Configuration File (Template Date: 30.07.2016) # -# UTF-8 Coding required! # -# incl. FailSafe functions that are active when information is missing. # -#################################################################################################### - -#==================================================================================================# -########################################## General Setup ########################################### -#==================================================================================================# - -#################################################################################################### -# Path in which the log files will be stored. # -# Example: E:\LogFiles\ # -# FailSafe Setting is: \Logs # -#################################################################################################### -LogPath = - -#################################################################################################### -# Numerical value how long (in days) log files will be kept. ValidateRange is 0 - 1000 # -# Setting the Value to 0 disables this Function. # -# FailSafe Setting is: 60 # -#################################################################################################### -LogFileKeepTime = 30 - -#################################################################################################### -# Numerical value how long (in Minutes) a File has to be there, before processing it. # -# FailSafe Setting is: 5 # -#################################################################################################### -FileDelayAge = 1 - -#==================================================================================================# -######################################## Database settings ######################################## -#==================================================================================================# - -#################################################################################################### -# Set the type of database Server # -# Example: MSSQL # -#################################################################################################### -DBType = MSSQL - -#################################################################################################### -# Set the database connection string. # -# For help, visit https://www.connectionstrings.com/ # -# IMPORTANT: mask ";" with a "\" = "\;" # -# Example: "Data Source=SERVERNAME\INSTANCE\;Initial Catalog=DD_ECM\;Trusted_Connection=True\; # -# TrustServerCertificate=true\;" # -# Example: "Data Source=SERVERNAME\INSTANCE\;Initial Catalog=DD_ECM\;User Id=SQLUSERNAME\; # -# Password=SQLPASSWORD\;TrustServerCertificate=true\;" # -#################################################################################################### -#DBConnString = "Data Source=S-ZLSDMS-DB1\;Initial Catalog=DD_ECM\;Trusted_Connection=True\;TrustServerCertificate=true\;" -DBConnString = "Data Source=SDD-VMP04-SQL17\DD_DEVELOP01\;Initial Catalog=DD_ECM\;Trusted_Connection=True\;TrustServerCertificate=true\;" - -#==================================================================================================# -########################################## Profile Setup ########################################### -#==================================================================================================# - -#################################################################################################### -# In the following section(s), it is possible to use multiple variables in File and Folder Paths, # -# in SQL Statements as well and other data related specifications. # -# # -# = # -# %USERNAME% = The current User Name running this Script # -# %USERDOMAIN% = The current Domain Name, User is logged on # -# %COMPUTERNAME% = The Computername on which this Script is running # -# %LOGONSERVER% = The currently connected Domain Controller # -# %SCAN%& = Scan Tag for Batch scanning, will be replaced with - nothing # -# %DATE% = Get Date in this Format: dd.MM.yyyy # -# %TIMESTAMP1% = Get Date in this Format: ddMMyyyy # -# %TIMESTAMP2% = Get Date and Time in this Format: ddMMyyyy_HHmmss # -# %TIMESTAMP3% = Get Date and Time in this Format: ddMMyyyy_HHmmssffff # -# %TIMESTAMP4% = Get Date and Time in this Format: yyyyMMdd HHmmssfff # -# %TIMESTAMP5% = Get Date and Time in this Format: yyyyMMdd_HHmmss # -# %TIMESTAMP6% = Get Date in this Format: dd.MM.yyyy # -# %TIMESTAMP7% = Get Date and Time in this Format: dd.MM.yyyy_HH:mm:ss # -# %TIMESTAMP8% = Get Date and Time in this Format: dd.MM.yyyy_HH:mm:ss.ffff # -# %TIMESTAMP9% = Get Date and Time in this Format: yyyy/MM/dd HH:mm:ss.fff # -# %TIMESTAMP10% = Get Date and Time in this Format: yyyy/MM/dd HH:mm:ss # -#--------------------------------------------------------------------------------------------------# -# Additional Variables specific for this Script are: # -# %SourceFile% = Name of the processed File, including its Extension # -# %SourceFilePath% = Directory of the processed File # -# %SourceFileFullName% = Directory and Name of the processed File, including its Extension # -# # -# This dump table is matching with Function: "Update-ReplacePlaceholder-withLogging" # -# Version Number: 1.0.0.0 / Version Date: 25.10.2018 # -#################################################################################################### - -#################################################################################################### -# Define Profiles in this config file for the executing Script. # -# Syntax: # -# Profile = ; ; ; ; ; # -# ; ; # -# Example: # -# Profile = BulkImport ; e:\SourceFile.csv # -# Profile = CheckSQLQuery ; SQL Statement (SELECT) # -# Profile = InitialSQLQuery ; SQL Statement (SELECT, INSERT, UPDATE) # -# Profile = PreparingSQLQuery ; SQL Statement (SELECT, INSERT, UPDATE) # -# Profile = MainLoopSQLQuery ; SQL Statement (INSERT, UPDATE) # -# Profile = FinalSQLQuery ; SQL Statement (SELECT, INSERT, UPDATE) # -#--------------------------------------------------------------------------------------------------# -# First Parameter: # -# Set the way, Script is reading the SourceFile. # -# Currently only the BulkImport is available. # -# Example: BulkImport # -#--------------------------------------------------------------------------------------------------# -# Second Parameter: # -# Set the full path and name to the file which includes the list you want to Import. # -# Make sure, file is .csv and value separation is done by ";". # -# Example: E:\UserList.csv # -#--------------------------------------------------------------------------------------------------# -# Optional Parameter: %ImportPathAD=,, # -# Determ the TargetPath in your Active Directory (part of the distinguishedName). # -# If you dont use this Parameter, TargetPath will be the "Users" Folder by default. # -# Example: OU=Testuser,DC=domainname,DC=local # -#--------------------------------------------------------------------------------------------------# -# Optional Parameter: %ReportFile=\.csv # -# By setting this Parameter, you get a overview file, which includes every created User, # -# with all available data (UserName, PreName, Surname, Password ...) # -# Example: %ReportFile=E:\ReportFile.csv # -#--------------------------------------------------------------------------------------------------# -# Argument call: # -# If you need to run the Script with dynamic Values, you can do so, by calling it with arguments. # -# Even the Special and Optional Parameters are available in this case. # -# Example: # -# This Function is currently not implement! # -#################################################################################################### - -Profile = CSVImport ; %CellValue% ; D:\ScriptFiles\Import-FileContentToDB\*.csv ; 4 ; 999999999 ; \^\,\^|\^ ; E:\archiv ; E:\error -#Profile = ExcelImport ; %CellValue% ; D:\ScriptFiles\Import-FileContentToDB\Stammdaten.xlsx ; 4 ; 999999999 ; \^\,\^|\^ ; E:\archiv ; E:\error -CheckSQL = SELECT 'true' -InitialSQL = -PreparingSQL = DELETE FROM [DD_ECM].[dbo].[TBCUST_XAP_KUNDENSTAMM_TEST] -MainLoopSQL = INSERT INTO [DD_ECM_ZLS].[dbo].[TBCUST_XAP_DOC_EXPORT]([XAP_Beleg_ID],[XAP_Kunden_ID],[XAP_Kundenname],[XAP_Objekt_ID],[XAP_Objektbezeichnung],[XAP_Belegdatum],[XAP_Formular_ID],[XAP_Exportpfad],[ADDED_WHO],[ADDED_WHEN]) SELECT '%column1%','%column2%','%column3%','%column4%','%column5%','%column6%','%column7%','%column8%','DD',getdate() -FinalSQL = - -#Example: -#Profile = CSVImport ; %ColumnName%|%CellValue% ; P:\Skriptentwickung\development\Import-CSV2DB\test-dateien\AltesFormat\*.txt ; 1 ; 2 ; . ;%SourceFilePath%\Archiv\%Timestamp5% ; %SourceFilePath%\Error -#Profile = CheckSQLQuery = SELECT 'true' -#Profile = InitialSQLQuery = SELECT (SELECT [u003] FROM [CWLDATEN].[dbo].[t693] WHERE [u000] = 1)+1 -#Profile = PreparingSQLQuery = INSERT INTO [CWLDATEN].[dbo].[TBDD_BATCHIMPORT_HEAD] (BELEGKEY, Konto, Laufnummer, Auftragsnummer) VALUES (%InitialSQLResult%, '700131', NULL, NULL) UPDATE [CWLDATEN].[dbo].[t693] SET u003 = %InitialSQLResult% WHERE [u000] = 1 -#Profile = MainLoopSQLQuery = INSERT INTO [CWLDATEN].[dbo].[t699] (u000, u001, u002, u003, u004, u005, u006, u007, u008, u009, u010, u011, u012, u013, u014, u015, u016, u029, u030) Select ISNULL(MAX(u000),0) + 1, %InitialSQLResult%, '%sourcefile%', '%column3%', '%column1%', '%column2%', '%column3%', '%column4%', '%column5%', '%column6%', '%column7%', '%column8%', '%column9%', '%column10%', '%column11%', '%column12%', '%column13%', getdate(), '%username%' FROM [CWLDATEN].[dbo].[t699] -#Profile = FinalSQLQuery = - - diff --git a/current/Import-FileContentToDB/Import-FileContentToDB_Settings.ini b/current/Import-FileContentToDB/Import-FileContentToDB_Settings.ini index 4271def..89a7ae9 100644 --- a/current/Import-FileContentToDB/Import-FileContentToDB_Settings.ini +++ b/current/Import-FileContentToDB/Import-FileContentToDB_Settings.ini @@ -125,12 +125,19 @@ DBConnString = "Data Source=SDD-VMP04-SQL17\DD_DEVELOP01\;Initial Catalog=DD_ECM # This Function is currently not implement! # #################################################################################################### +#header line, codierung, remove, cleancode +Profile = ExcelImport ; %CellValue% ; D:\ScriptFiles\Import-FileContentToDB\Stammdaten.xlsx ; 5 ; 10 ; XAP__Stammdaten_Adressen(2) ; E:\archiv ; E:\error +CheckSQL = +InitialSQL = DELETE FROM [DD_ECM_ZLS].[dbo].[TBCUST_XAP_KUNDENSTAMM] +PreparingSQL = +MainLoopSQL = INSERT INTO [DD_ECM_ZLS].[dbo].[TBCUST_XAP_KUNDENSTAMM]([Kundennummer],[Objektnummer],[Versorgungsart],[rAdressart],[rAnrede],[rNAME1],[rNAME2],[rStraße],[rHausnummer],[rPostfach],[rPLZ],[rOrt],[rTelefon],[rMail],[vAdressart],[vAnrede],[vNAME1],[vNAME2],[vStraße],[vHausnummer],[vPostfach],[vPLZ],[vOrt],[vTelefon],[vMail],[ADDED_WHO],[ADDED_WHEN]) SELECT '%column1%','%column2%','%column3%','%column4%','%column5%','%column6%','%column7%','%column8%','%column9%','%column10%','%column11%','%column12%','%column13%','%column14%','%column15%','%column16%','%column17%','%column18%','%column19%','%column20%','%column21%','%column22%','%column23%','%column24%','%column25%','Import-FileContentToDB',getdate() +FinalSQL = + Profile = CSVImport ; %CellValue% ; D:\ScriptFiles\Import-FileContentToDB\*.csv ; 4 ; 999999999 ; \^\,\^|\^ ; E:\archiv ; E:\error -#Profile = ExcelImport ; %CellValue% ; D:\ScriptFiles\Import-FileContentToDB\Stammdaten.xlsx ; 4 ; 999999999 ; \^\,\^|\^ ; E:\archiv ; E:\error CheckSQL = SELECT 'true' InitialSQL = -PreparingSQL = DELETE FROM [DD_ECM].[dbo].[TBCUST_XAP_KUNDENSTAMM_TEST] -MainLoopSQL = INSERT INTO [DD_ECM_ZLS].[dbo].[TBCUST_XAP_DOC_EXPORT]([XAP_Beleg_ID],[XAP_Kunden_ID],[XAP_Kundenname],[XAP_Objekt_ID],[XAP_Objektbezeichnung],[XAP_Belegdatum],[XAP_Formular_ID],[XAP_Exportpfad],[ADDED_WHO],[ADDED_WHEN]) SELECT '%column1%','%column2%','%column3%','%column4%','%column5%','%column6%','%column7%','%column8%','DD',getdate() +PreparingSQL = DELETE FROM [DD_ECM_ZLS].[dbo].[TBCUST_XAP_DOC_EXPORT] +MainLoopSQL = INSERT INTO [DD_ECM_ZLS].[dbo].[TBCUST_XAP_DOC_EXPORT]([XAP_Beleg_ID],[XAP_Kunden_ID],[XAP_Kundenname],[XAP_Objekt_ID],[XAP_Objektbezeichnung],[XAP_Belegdatum],[XAP_Formular_ID],[XAP_Exportpfad],[ADDED_WHO],[ADDED_WHEN]) SELECT '%column1%','%column2%','%column3%','%column4%','%column5%','%column6%','%column7%','%column8%','Import-FileContentToDB',getdate() FinalSQL = #Example: