January 25, 2009 at 11:41 am
I want to populate a column that have the values null of an table that contains data with data from one column to another table. who I do this? with insert or update?
INSERT INTO [Teste].[dbo].[Clientes](Morada)
SELECT LastName
FROM [AdventureWorks].[Person].[Contact]
With this query data are inserted in the table after other rows and all other columns stay with value null :crying:
January 26, 2009 at 1:54 am
>>I want to populate a column that have the values null of an table that contains data with data from one column to another table. who I do this? with insert or update?
This assumes that you have data in a table alreday then you should use UPDATE to populate the column where data is missing.
>>INSERT INTO [Teste].[dbo].[Clientes](Morada)
SELECT LastName
FROM [AdventureWorks].[Person].[Contact]
In the above, you are populating data for only one column only as you verified. If the data is coming from multiple tables then you need to use joins. post back with the table schema you are working with, someone here should be able to help you.
[font="Courier New"]Sankar Reddy | http://SankarReddy.com/[/url][/font]
January 27, 2009 at 10:58 pm
use UPDATE instead of INSERT query
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply