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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-01-15 : 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 exampleInsert 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
85 Posts |
Posted - 2003-01-15 : 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 thefield in table_B which holds the value of thing |
|
|
|
|
|