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.
Author |
Topic |
eirikr_1
Starting Member
27 Posts |
Posted - 2013-02-07 : 12:20:57
|
I need some help with a query to split a tablemaster tableId ComputerName Ip Vuln ScanDate1 computerA 1.1.1 iav1 1/1/132 computerA 1.1.1 iav2 1/1/133 computerB 2.2.2 iav3 2/1/13into to computerInfo tableId ComputerName Ip1 computerA 1.1.12 computerB 2.2.2vulnerabilities tableId ComputerId Vuln ScanDate1 1 iav1 1/1/132 1 iav2 1/1/133 2 iav3 2/1/13thank you |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-07 : 16:43:03
|
[code]-- first tableSELECT DISTINCT IDENTITY(INT,1,1) as ID, ComputerName INTO ComputerInfoTable FROM MasterTable;-- second tableSELECT a.Id,b.Id AS ComputerId,a.Vuln,a.ScanDateINTO VulnerabilitiesTableFROM MasterTable a INNER JOIN ComputerInfoTable b ON a.ComputerName = b.computername;[/code] |
|
|
eirikr_1
Starting Member
27 Posts |
Posted - 2013-02-10 : 01:21:34
|
Thank you James |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-10 : 06:40:01
|
You are very welcome - glad to help. |
|
|
|
|
|