Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Inserting columns and data

Author  Topic 

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-03-08 : 12:01:23
Data conversion. Two of the customers tables (in SQL) should actually be combined into one of our tables. Their two tables are WarrantData and WarrantDefendant. I would like to combine all columns and data from both into one table on our side (dbo.Arrest). There would be no duplicate column names in the new table if i pulled the data directly over to our side. The columns that join the data between warrantdata(wd) and warrantdefendant(wfd) are warrantID from wfd and ID from wd. How do i script a 'select * into dbo.arrest' from both of these tables joining the data on warrantid wfd and id wd? Also, there are no duplicate id's or warrantid's in either table.

thank you!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-08 : 12:10:20
[code]
SELECT * INTO dbo.arrest
FROM WarrantData wd
INNER JOIN WarrantDefendant wdef
ON wdef.warrantID = wd.ID
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

WJHamel
Aged Yak Warrior

651 Posts

Posted - 2012-03-08 : 12:21:20
as simple as i feared.

thank you.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-08 : 12:28:19
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -