gabepcsolutions
asked on
OVERWRITE RECORDS ON TABLE FROM ANOTHER TABLE
I need to replace a number of records from database1.table to database2.table , I dont want to copy them from table to table because I dont want duplicates, I want to replace records.
The ideas is restore information from a backup database to the current database, what would be the best way to write the query?
The ideas is restore information from a backup database to the current database, what would be the best way to write the query?
ASKER
Actually, what I need is to select all records on CLIENT LIST table that match a CODEID and replace the entire record.
For example, I did this in the past to replace the entire table.
SELECT *
INTO [PIProDev].[dbo].[CLIENT LIST]
FROM [PIPro].[dbo].[CLIENT LIST]
For example, I did this in the past to replace the entire table.
SELECT *
INTO [PIProDev].[dbo].[CLIENT LIST]
FROM [PIPro].[dbo].[CLIENT LIST]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you only want to update from t1 if a valid value is there, you can use:
t2.colname = isnull(t1.colname, t2.colname)
This will leave value as is if column is null in table1.
Open in new window