SQL Help needed combining 2 tables into one.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 yıl önce
I am trying to combine 2 of the dbo.Product tables from a database called HCS  and the other is nopaccu into one.  I deleted half the table not thinking and want to restore that missing part to the newer table.

What SQL Query will work for combining the tables while keeping the ID numbers?

First table goes ID numbers 1-996

Second Table goes
ID Numbers 2054-3064
12 yıl önce
I made this but it's not saving to sql?

SELECT [Id]
      ,[Name]
      ,[ShortDescription]
      ,[FullDescription]
      ,[AdminComment]
      ,[ShowOnHomePage]
      ,[MetaKeywords]
      ,[MetaDescription]
      ,[MetaTitle]
      ,[SeName]
      ,[AllowCustomerReviews]
      ,[ApprovedRatingSum]
      ,[NotApprovedRatingSum]
      ,[ApprovedTotalReviews]
      ,[NotApprovedTotalReviews]
      ,[Published]
      ,[Deleted]
      ,[CreatedOnUtc]
      ,[UpdatedOnUtc]
      ,[ProductTemplateId]
  FROM [hcs].[dbo].[Product]
Union

SELECT [Id]
      ,[Name]
      ,[ShortDescription]
      ,[FullDescription]
      ,[AdminComment]
      ,[ShowOnHomePage]
      ,[MetaKeywords]
      ,[MetaDescription]
      ,[MetaTitle]
      ,[SeName]
      ,[AllowCustomerReviews]
      ,[ApprovedRatingSum]
      ,[NotApprovedRatingSum]
      ,[ApprovedTotalReviews]
      ,[NotApprovedTotalReviews]
      ,[Published]
      ,[Deleted]
      ,[CreatedOnUtc]
      ,[UpdatedOnUtc]
      ,[ProductTemplateId]
  FROM [nopaccu].[dbo].[Product]
  GO
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.