Jump to content
x_soldier

[Resolvido] Script SQL - Select uma Tabela Insert em Outra Tabela

Recommended Posts

x_soldier

Boas Pessoal,

Fiz aqui um pequeno código que funciona, apenas queria uma pequena ajuda para algo que faça o mesmo mas que seja mais elegante, este que fiz está com aspecto de martelada :)

INSERT INTO ossys_group (NAME, DESCRIPTION)

SELECT NAME, DESCRIPTION

FROM OSUSR_a7l_ROLE

UPDATE ossys_group SET CREATED_BY = 36

UPDATE ossys_group SET CREATED = GETDATE()

UPDATE ossys_group SET Tenant_Id = 161

Obrigado

Share this post


Link to post
Share on other sites
Rechousa

Olá,

Tipo isto?

INSERT INTO ossys_group (NAME, DESCRIPTION, CREATED_BY, CREATED, Tenant_Id)
SELECT NAME, DESCRIPTION, 36, GETDATE(), 161
       FROM OSUSR_a7l_ROLE;

Espero ter ajudado,


Pedro Martins

Sharing is Knowledge!

http://www.linkedin.com/in/rechousa

Share this post


Link to post
Share on other sites
x_soldier

Olá,

Tipo isto?

INSERT INTO ossys_group (NAME, DESCRIPTION, CREATED_BY, CREATED, Tenant_Id)
SELECT NAME, DESCRIPTION, 36, GETDATE(), 161
	FROM OSUSR_a7l_ROLE;

Espero ter ajudado,

Bom Dia Pedro,

Era mesmo isto... Já tinha feito algo parecido mas não estava a funcionar!

Simplesmente perfeito :) Obrigado pela tua disponibilidade.

Um Abraço :thumbsup:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.