Jump to content

Recommended Posts

Posted

Hi there I am trying to update a field in our contact table. I have a view which contains all of the contacts that i need to run the update for, my question is:

 

How do i update a contact table but only update the contacts that are in my custom view?

Posted

Hi there, you might want to look at something like:

 

Update TableName Set FieldName = CustomView.Field 
From TableName
Inner Join CustomView on
TableName.PrimaryKeyField = CustomView.ForeignKeyField

Posted

If all columns are the same I'd use something like:

 

select *

from (select * from old_data_table_name)

union

select * from new_data_view_name)

into temp_data_table

 

drop old_data_table

 

select *

into old_data_table_name

from temp_data_table

 

drop temp_data_table

 

Bit rough and ready because you're creating a new table of contacts and need to drop the old contact table but it works... ;)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...