Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to over-write a table in C# Sql select
Message
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
01475647
Message ID:
01475680
Views:
30
>Thanks Naomi. That works fine.
>
>One other similar question
>Is there any construct in SQL to emaulate the Append, but keeping existing fields intact
>e.g.
>TableA has Country,State,City,Town and is empty (no records)
>TableB has Country State and has some ecords in it
>
>Sele TableA
>Append From tableB
>..... This keeps the structure in TableA but adds on all the records from tableB and pads out fields with spaces or Zeros that exist in TableA but not in TableB
>There would not be a key linking both tables.
>
>
>Regards,
>Gerard
>
Insert into TableA (Country, State) select * from TableB 
where not exists
 (select 1 from TableA where TableA.State = TableB.State and TableA.City = TableB.City) -- if you only want to append new (not existing) records
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform