11. August 2018 12:46
14. August 2018 13:51
14. August 2018 14:22
14. August 2018 14:26
14. August 2018 14:32
Außerdem beachten, dass bei NAV 2018 CU2 ein "Zwischenstopp" erforderlich ist:
14. August 2018 14:50
Fiddi hat geschrieben:sicher?
14. August 2018 17:34
14. August 2018 18:35
Die kundenspezifischen Anforderungen werden basierend auf den Vorgaben von MS und deren dazugehörende technische Neuerungen vollständig neu ausgearbeitet und entsprechend implementiert
15. August 2018 08:42
15. August 2018 17:43
17. August 2018 00:38
17. August 2018 07:18
17. August 2018 13:20
17. August 2018 13:21
17. August 2018 13:37
AchimMueller hat geschrieben:die PowerShell sagt, dass es dort kein CMLet "Sync-Tenant" gäbe. Ich scheine auf dem Schlauch zu stehen.
17. August 2018 13:39
17. August 2018 15:05
fiddi hat geschrieben:Du hast auch die "Dynamics NAV XXXX Administration Shell" benutzt?
@elTorito:
Magst du dein Skript veröffentlichen?
Gruß Fiddi
-- Übernimmt alle Felder aus Tabelle NAV2018
INSERT INTO NavFields09vs18 (TableNo,TableName2018,FieldNo,FieldName2018 ,FieldNeededIn2018, Type2018, Class2018, Enabled2018)
SELECT TableNo,TableName,No,FieldName, 0, Type, Class, Enabled FROM NAV2018$
-- Updatet alle Feldnamen2018 in NavFields09vs18 welche TableNo und FeldNo gleich sind
UPDATE NavFields09vs18 SET FieldName2009 = (SELECT FieldName FROM Nav2009$ WHERE NavFields09vs18.TableNo = Nav2009$.TableNo AND NavFields09vs18.FieldNo = Nav2009$.No)
UPDATE NavFields09vs18 SET TableName2009 = (SELECT TableName FROM NAV2009$ WHERE NavFields09vs18.TableNo = Nav2009$.TableNo AND NavFields09vs18.FieldNo = Nav2009$.No)
UPDATE NavFields09vs18
SET FieldName2009ChangedIn2018 = CASE
WHEN FieldName2018 <> FieldName2009 THEN 1
ELSE 0
END
UPDATE NavFields09vs18
SET TableChangedNameIn2018 = CASE
WHEN TableName2018 <> TableName2009 THEN 1
ELSE 0
END
UPDATE NavFields09vs18
SET TableDeletedIn2018 = CASE
WHEN NOT EXISTS (SELECT 1 FROM NAV2018$ WHERE TableNo = [NAV2018$].[TableNo]) THEN 1
ELSE 0
END
SELECT TableNo, TableName2009,TableName2018, TableChangedNameIn2018 FROM NavFields09vs18 WHERE TableChangedNameIn2018 = 1 GROUP BY TableChangedNameIn2018, TableNo, TableName2009,TableName2018
SELECT *
FROM [DemoDB].[dbo].[NavFields09vs18] ORDER by TableNo, FieldNo ASC
static void CreateTSQLScripts()
{
using (var db = new DemoDBEntities())
{
IEnumerable<int> mytables = new int[] {};
mytables = new int[] { 9};
// Display all affected tables
var affectedTables = from navfields in db.NavFields09vs18
where (mytables.Contains(navfields.TableNo))
group navfields.TableNo by navfields.TableNo into tablegroup
orderby tablegroup.Key ascending
select tablegroup.Key;
foreach (var tno in affectedTables)
{
System.Diagnostics.Debug.WriteLine("--Create TSQL for TableNo " + tno);
CreateTSql.CreateSqlScript(tno);
}
}
}
public static void CreateSqlScript(int tableNo)
{
using (var db = new DemoDBEntities())
{
// Display all Data from the database
var query = from b in db.NavFields09vs18
where (b.TableNo == tableNo && b.Class2018 != "FlowField" && b.Class2018 != "FlowFilter" && b.Enabled2018 == "Ja")
orderby b.TableNo, b.FieldNo
select b
;
string Columns2018 = "";
string TableName = "";
//System.Diagnostics.Debug.WriteLine("All Columns in the Table:");
foreach (var item in query)
{
Columns2018 = Columns2018 + '[' + DataClass.ReplaceChar(item.FieldName2018) + ']' + ',';
TableName = DataClass.ReplaceChar(item.TableName2018);
}
Columns2018 = Columns2018.Remove(Columns2018.Length - 1);
string sqlcmd = "";
string sqlcmddelete = "";
if (Settings.WithDeleteStatements == true)
{
sqlcmddelete = sqlcmddelete + "DELETE FROM [NAVDB_110].[dbo].[" + Settings.TargetCompany + "$" + TableName + "]";
}
sqlcmd = sqlcmd + "INSERT INTO [NAVDB_110].[dbo].[" + Settings.TargetCompany + "$" + TableName + "] (";
sqlcmd = sqlcmd + Columns2018 + ") ";
DataTable dt18 = DataClass.GetSQLTableSchema(Settings.ConnStringPFGNWOOD18, "[NAVDB_110].[dbo].["+ Settings.TargetCompany + "$" + TableName + "]");
DataTable dt09 = DataClass.GetSQLTableSchema(Settings.ConnStringPFGNWOOD09, "[NAVDB_TEST].[dbo].["+ Settings.SourceCompany + "$" + TableName + "]");
sqlcmd = sqlcmd + " SELECT ";
if (Settings.SelectNRowsToInsert > 0)
{
sqlcmd = sqlcmd + " TOP (" + Settings.SelectNRowsToInsert.ToString()+") " ;
}
string Columns2009 = "";
foreach (var item in query)
{
if (item.FieldName2009 != null)
{
if (item.FieldName2009ChangedIn2018 == true)
{
//System.Diagnostics.Debug.WriteLine("FNo: "+ item.FieldNo +" Field2009: " + item.FieldName2009 + " F18: " + item.FieldName2018 + " Type" + item.Type2018);
Columns2009 = Columns2009 + CompareTableFields.GetFieldTypeIn2018(TableName, DataClass.ReplaceCharPoint(item.FieldName2018)) +",";
} else if (CheckTypeIn2009Equivalent(item.FieldName2009,dt09) != "")
{
Columns2009 = Columns2009 + CheckTypeIn2009Equivalent(item.FieldName2009, dt09) + ',';
}
else {
Columns2009 = Columns2009 + '[' + DataClass.ReplaceCharPoint(item.FieldName2009) + ']' + ',';
}
}
else
{
//System.Diagnostics.Debug.WriteLine("FNo: " + item.FieldNo + " Field2009: " + item.FieldName2009 + " F18: " + item.FieldName2018 + " Type" + item.Type2018);
switch (item.Type2018)
{
case "GUID":
Columns2009 = Columns2009 + "NEWID() ,";
break;
case "Media":
Columns2009 = Columns2009 + "NEWID() ,";
break;
case "DateTime":
Columns2009 = Columns2009 + "SYSDATETIME() ,";
break;
case "Decimal":
Columns2009 = Columns2009 + "0 ,";
break;
case "RecordID":
Columns2009 = Columns2009 + "cast('' as varbinary(50)) ,";
break;
default:
Columns2009 = Columns2009 + " '',";
break;
}
}
}
if (Columns2009.EndsWith(","))
Columns2009 = Columns2009.Remove(Columns2009.Length - 1);
sqlcmd = sqlcmd + Columns2009+" ";
sqlcmd = sqlcmd + " FROM [SQLTEST].[NAVDB_TEST].[dbo].[" + Settings.SourceCompany + "$" + TableName + "] t1 ";
string strKeyFields = "";
string strIdentityON = "";
string strIdentityOFF = "";
foreach (DataRow field in dt18.Rows)
{
foreach (DataColumn property in dt18.Columns)
{
if (property.ColumnName == "IsKey")
{
if (field[property].ToString() == "True")
{
strKeyFields = strKeyFields + "[" + field[0] + "],";
//System.Diagnostics.Debug.WriteLine(field[0] + " " + property.ColumnName + " " + field[property].ToString());
}
}
if (property.ColumnName == "IsIdentity")
{
//System.Diagnostics.Debug.WriteLine(field[0] + " " + property.ColumnName + " " + field[property].ToString());
if (field[property].ToString() == "True")
{
strIdentityON = "SET IDENTITY_INSERT [NAVDB_110].[dbo].[" + Settings.TargetCompany + "$" + TableName + "] ON";
strIdentityOFF = "SET IDENTITY_INSERT [NAVDB_110].[dbo].[" + Settings.TargetCompany + "$" + TableName + "] OFF";
}
}
}
}
if (strKeyFields.Count() > 1)
strKeyFields = strKeyFields.Remove(strKeyFields.Length - 1);
string checkKeys = "";
string[] s = strKeyFields.Split(',');
foreach (string w in s)
{
checkKeys = checkKeys + "t2." + w +"=t1."+w+" "+CheckFieldForCollate(w, TableName, dt18)+" AND ";
}
checkKeys = checkKeys.Remove(checkKeys.Length - 4);
sqlcmd = sqlcmd + " WHERE NOT EXISTS(SELECT "+ strKeyFields + " FROM [NAVDB_110].[dbo].[" + Settings.TargetCompany + "$" + TableName + "] t2 WHERE "+checkKeys+")";
foreach (DataRow field in dt09.Rows)
{
//System.Diagnostics.Debug.WriteLine(field[0]);
//sqlcmd = sqlcmd + "["+ DataClass.ReplaceChar(field[0].ToString())+"],";
}
if (TableName == "Payment Terms") { }
if (TableName == "Country_Region"){//Besondere behandlung notwendig?}
System.Diagnostics.Debug.WriteLine(sqlcmddelete);
if (strIdentityOFF != "")
{
System.Diagnostics.Debug.WriteLine(strIdentityOFF);
}
System.Diagnostics.Debug.WriteLine(sqlcmd);
if (strIdentityON != "")
{
System.Diagnostics.Debug.WriteLine(strIdentityON);
}
}
28. August 2018 16:55
28. August 2018 17:27
29. August 2018 00:24
31. August 2018 16:18
fiddi hat geschrieben:Du hast auch die "Dynamics NAV XXXX Administration Shell" benutzt?
@elTorito:
Magst du dein Skript veröffentlichen?
Gruß Fiddi
1. September 2018 21:49
$NavVersion = 100
$DatabaseName = "MyDataBase"
$WorkDir = "C:\Temp\Objects\"
26. November 2018 16:13
elTorito hat geschrieben:fiddi hat geschrieben:Du hast auch die "Dynamics NAV XXXX Administration Shell" benutzt?
Hier Mein Beitrag zum Wochenende