Link to home
Start Free TrialLog in
Avatar of blossompark
blossomparkFlag for Ireland

asked on

Dynamically updating Table from query result in sql server 2005

Hi,
I have an existing table in sql server 2005 database
Id (int, not null)
LoadDate (datetime, null)
Client  (nvarchar,null)
Location (nvarchar, null)
 User generated imageI want to update this table dynamically using the results of the following query;

Select  client Location
From RawData.NewData

The ID value to be incremented and the LoadDate value to be the date when the query is fired.

any help appreciated..Thanks
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of blossompark

ASKER

Hi angelII,  thanks for the link
Hi Lowfatspread, thanks for that, trying now, will update when complete
Hi AngelII, great info there that i will need to study, thank you...

Hi Lowfatspread, thanks for your input , table has loaded with the data.
I used the following code only for my requirement;
insert into [client table]
(loaddate,client,location)
Select  getdate(),client, Location
From RawData.NewData

I'm assuming
where not exists (select client from [client table] as x where x.client=rawdata.newdata.client
 and x.location=rawdata.newdata.location)

is to prevent duplicate combinations of  client/location from being entered into the client table?

If that is the case that is not a concern in this instance...
as the LoaDate/Client/Location is what needs to be unique