SET IDENTITY_INSERT xxxxxxxxxxxxxxx ON
Insert into xxxxxxxxxxxxxxx
SET IDENTITY_INSERT xxxxxxxxxxxxxxx OFF
DBCC CHECKIDENT ("xxxxxxxxxxxxxxx", RESEED, 10000)
SELECT sys.tables.name as TablNAme From sys.tables Where sys.tables.name Like 'ParData%'
-- ΑΛΛΑΓΗ ΟΛΩΝ ΤΩΝ PHONES ΑΠΟ DATA GROUP => ΟΜΑΔΑ COMPANY DATA ΣΕ DATA GROUP => DATA --------------------------------
UPDATE PelDataPhone set dbo.PelDataPhone.CodPelData = PelData_1.Cod
FROM dbo.PelDataPhone INNER JOIN dbo.PelData ON dbo.PelDataPhone.CodPelData = dbo.PelData.Cod
INNER JOIN dbo.Pel ON dbo.PelData.CodPel = dbo.Pel.Cod
INNER JOIN dbo.PelData AS PelData_1 ON dbo.Pel.Cod = PelData_1.CodPel
WHERE (PelData.CodPelDataTypos = 3) -- LAND LINE
AND (PelData_1.CodPelDataTypos = 80) --
-- ΑΛΛΑΓΗ ΕΝΟΣ TEXT ΑΠΟ DATA GROUP => ΟΜΑΔΑ ΑΑΑΑΑΑ ΣΕ DATA GROUP => ΒΒΒΒΒΒΒ --------------------------------
Select * from PelDataTypos -- π.χ 3 = COMPANY DATA 80 = DATA
Select * from PelDataTextTypos -- π.χ 34 = Text αααααααα
UPDATE PelDataText set dbo.PelDataText.CodPelData = PelData_1.Cod
FROM dbo.PelData INNER JOIN
dbo.Pel ON dbo.PelData.CodPel = dbo.Pel.Cod INNER JOIN
dbo.PelData AS PelData_1 ON dbo.Pel.Cod = PelData_1.CodPel INNER JOIN
dbo.PelDataText ON dbo.PelData.Cod = dbo.PelDataText.CodPelData
WHERE (PelData.CodPelDataTypos = 3) -- FROM PelDataTypos
AND (PelData_1.CodPelDataTypos = 80) -- TO PelDataTypos
AND (dbo.PelDataText.CodPelDataTextTypos = 34) -- PelDataText
-- COPY TEXT ΑΠΟ DATA GROUP => ΟΜΑΔΑ ΑΑΑΑΑΑ ΣΕ DATA GROUP => ΒΒΒΒΒΒΒ --------------------------------
Insert into PelDataTEXT ( CodPelData , CodPelDataTextTypos , TimiText , Sxolio , OrderNo )
select PelData_1.cod , 34 , PelDataTEXT.TimiText , PelDataTEXT.Sxolio , PelDataTEXT.OrderNo
FROM dbo.PelData INNER JOIN
dbo.Pel ON dbo.PelData.CodPel = dbo.Pel.Cod INNER JOIN
dbo.PelData AS PelData_1 ON dbo.Pel.Cod = PelData_1.CodPel INNER JOIN
dbo.PelDataTEXT ON dbo.PelData.Cod = dbo.PelDataTEXT.CodPelData
WHERE (PelData.CodPelDataTypos = 70) -- FROM AAAAAAAA
AND (PelData_1.CodPelDataTypos = 77) -- TO BBBBBBBBBB
AND (dbo.PelDataTEXT.CodPelDataTEXTTypos = 64) -- TO TEXT