Skip to content
Advertisement

Insert into select SQL with windowsForm

I want to insert some data in Table1 in my database selecting it from another Table2 but the Table1 has another attribute for username (ComputerName).

What I have tried:

INSERT INTO [AffecAnalytique].[dbo].[C9_V] ([C9], [V], [OID], [USERMODIF]) 
SELECT [C9], [V], [OID] FROM [AffecAnalytique].[dbo].[C9_V] 
WHERE [OID] = 'CEC4F038E3954AC79DBF7EC38B02171F' ,   'AHE'

Advertisement

Answer

I think you are looking for something like this :

INSERT INTO [AffecAnalytique].[dbo].[C9_V] ([C9], [V], [OID], [USERMODIF]) 
SELECT [C9], [V], [OID], 'AHE' FROM [AffecAnalytique].[dbo].[C9_V] 
WHERE [OID] = 'CEC4F038E3954AC79DBF7EC38B02171F' 
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement