rss
twitter
facebook

Home

INSERT INTO

INSERT INTO TableName
(TableName.CLIENT,
TableName.ENTITY,
TableName.CREATEDBY,
TableName.CREATEDATE,
TableName.UPDATEDBY,
TableName.UPDATEDBY,
TableName.INTERVINIENTTYPEID,
TableName.INTERVINIENTSRELATIONSHIPID,
TableName.[ClientNumber],
TableName.[EntityNumber])

SELECT TableName.[Id], TableName5.[Id],
'7',GETDATE(),'7',GETDATE(),
TableName2.[Id], TableName3.[Id],
TableName4.LTNCLI,TableName4.LTNTIT
FROM
[DataBaseName].[dbo].[TableName4]
LEFT JOIN DataBaseName.dbo.TableName ON LTRIM(RTRIM(TableName4.[LTNCLI])) = LTRIM(RTRIM(TableName.[ClientNumber]))
LEFT JOIN DataBaseName.dbo.TableName5 ON LTRIM(RTRIM(TableName4.[LTNTIT])) = LTRIM(RTRIM(TableName5.[EntityNumber]))
LEFT JOIN DataBaseName.dbo.TableName2 ON TableName4.[LTRCLI] = TableName2.[ExternalCode]
LEFT JOIN DataBaseName.dbo.TableName3 ON TableName4.[LTRCPE] = TableName3.[Description]
AND TableName3.[isActive] = 1

0 comentários:

 
Powered by Blogger