/****** Script do comando SelectTopNRows de SSMS  ******/
SELECT 

		concat('update or insert into TBECD (ID, CONTA, DESCRICAO, DATINIVAL, DATFINVAL, TIPO) values (',[Codigo],',''',[Codigo],''',''',[Descricao],''',''01.01.2000'',''31.12.2021'',',[Tipo],') matching (ID);') as SQL,

	   [Codigo]
      ,[Tipo]
      ,[CodigoGrupo]
      ,[CodigoCabeca]
      ,[Descricao]
  FROM [Alphaind].[dbo].[CabecadeConta]