Moving Data between SQL Server instances
How to Move a database between two SQL Server instances?
לקחתי space קיים של לקוח ואני מציג באילו Services הוא משתמש באמצעות השאילתא הבאה:
select PackageId, Services.ServiceID, ServiceName, ServerName, ServerUrl from PackageServices, Services, Servers where PackageServices.ServiceID = Services.ServiceID and servers.ServerID = Services.ServerID and PackageID=419
אפשר לראות מהתוצאות ששרת ה SQL שלו הוא ServiceID =XXX שרץ מהשרת XXXXXX
נניח שאנחנו רוצים להחליף את ה- SQL SERVER בSQL שמותקן על השרת XXX.XXX.XXX.XXX
declare @serverId int set @serverId = (select ServerID from Servers where ServerUrl like '%IP_adress%') select ServiceID, ServiceName from Services where ServerID = @serverId
לפי השאילתא אפשר לראות שצריך להחליף את ה ID הקודם XXX בID החדש YYY עבור ה PackageID שהוא 419
update PackageServices set ServiceID=1222 where ServiceID=XXX and PackageID = YYY
או אם אני רוצה להחליף השירות הזה באופן גורף בכל המערכת
update PackageServices set ServiceID=1222 where ServiceID=XXX
ולסיום סיומת העברה של המסדים הקיימים כך שיצביעו לשרת החדש:
update ServiceItems set ServiceID = 1222 where ServiceID = YYY