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 |
|
madscientist
Starting Member
30 Posts |
Posted - 2008-01-08 : 12:29:44
|
| Hi everyone,I created a table named NCCI_FINAL_HEADER but I want the columns to be populated from another table named HEADER.i.e. in NCCI_FINAL_HEADER I have a column named POLICY_NUMBER and want it to be populated by two columns from HEADER named CARRIERCODE & POLNUMID.I created a table named NCCI_FINAL_HEADER with all of the columns + attributes first. Then I was planning to use a SELECT CARRIERCODE + POLNUMID FROM HEADER to populate the POLICY_NUMBER column but don't know how to code the insert.Thank you for the help! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-01-08 : 12:35:37
|
| INSERT INTO NCCI_FINAL_HEADER (POLICY_NUMBER,other fields)SELECT CAST(CAST(CARRIERCODE AS varchar(50))+ CAST(POLNUMID AS varchar(50))AS int), other fieldsFROM HEADERMake sure CARRIERCODE and POLNUMID are of varchar type (blue code) before concatinating and cast to int if POLICY_NUMBER is of type int(green code) |
 |
|
|
|
|
|