| Author |
Topic  |
|
|
AskSQLTeam
Ask SQLTeam Question
USA
0 Posts |
Posted - 01/15/2003 : 14:56:50
|
Janice writes "not certian how to script the following: trying to insert records into TABLE_A, which has three values. The tricky part is one value is the result of a select statement on TABLE_B. For example
Insert TABLE_A (thing, personorgroup, accessrights) Values ('unknown', '998', '255')
the unknown is the results from: (select * from TABLE_B where author = '12067' and default_rights = '1') This totals approx 400 records so need to insert a record into TABLE_A for each of the 400 using the values above. Can anyone help? Using SQL Server 2000, OS is WIN2K" |
|
|
Tigger
Yak Posting Veteran
New Zealand
85 Posts |
Posted - 01/15/2003 : 16:25:28
|
This should do it:
Insert Into TABLE_A (thing, personorgroup, accessrights) SELECT <name of field from TABLE_B>, '998', '255' FROM TABLE_B where author = '12067' and default_rights = '1'
Just replace <name of field from TABLE_B> with the name of the field in table_B which holds the value of thing
|
 |
|
| |
Topic  |
|
|
|