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:
01475679
Views:
38
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



>>Hi.
>>I want to over-write a table in Sql using a select / update or whatever is most relevant.
>>
>>My Vfp Code would be:
>>
>>Set EngineBehavior 70
>>Select * ,Sum(Turnover) as Turnover, Sum(Cost) as Cost from Table1 into Table Table2 Group by Country, City
>>Sele Table1
>>Zap
>>Appe from Table2
>>
>>Suggestions in C# with Sqlserver woudl be appreciated
>>Regards,
>>Gerard
>
>One possibility:
>
>if object_ID('Table2','U') IS NOT NULL
>   drop table Table2
>
>select Country, City, sum(TurnOver) as TurnOver, Sum(Cost) as Cost into Table2 from Table1 group by Country, City
>
>Alternative solution is to truncate the table instead of dropping and re-creating.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform