I have to update the a table in sql server from one database to another and i was wondering how to do that with
here is my example
UPDATE [Logix].[sysdba].[TICKET] (
STATUSCODE)
SELECT TICKETID, GM_NUMBER, STATUSCODE
FROM [Logix_Dev].[sysdba].[TICKET]
where GM_NUMBER <> ''
but i feel like this is the wrong syntax…basically what i want to do is select all the records from the TICKET table in the Logix_Dev database and update the statuscode on the Logix database where the TICKETID match….
Use aliases to make your life easier (same instance):
Of course you will need to replace s.ID and l.ID with the appropriate columns (TicketID ?):
If they are on the same instance then do not need two dots (..). If it is a linked server or on another instance you need two dots (..):
Linked server: