iluvwitter
MIS
I am using a variable set by the user to insert multiple rows into a table leveraging values from another table.
Insert into TableA (code, type)
values (@code, type)
The type value is from another table, but I want to insert a row in TAble A for each Type existing in Table B. So if 5 different types exist in Table B, I want to insert 5 rows with @code and each different Type in TableA.
I would be using like condition to insert certain Types from Table B (i.e. insert into TAble A a record for each 'SP%' type in Table B) but really just need to understand how to insert values without specifying each specific type value in the insert statement since new types are consistently getting added to Table B. Thanks!
Insert into TableA (code, type)
values (@code, type)
The type value is from another table, but I want to insert a row in TAble A for each Type existing in Table B. So if 5 different types exist in Table B, I want to insert 5 rows with @code and each different Type in TableA.
I would be using like condition to insert certain Types from Table B (i.e. insert into TAble A a record for each 'SP%' type in Table B) but really just need to understand how to insert values without specifying each specific type value in the insert statement since new types are consistently getting added to Table B. Thanks!