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 |
|
cblatchford
Starting Member
40 Posts |
Posted - 2006-01-04 : 10:36:57
|
| Hi all,First of all great site, hope you can help me out!I'm fairly new to the t-sql world and am having trouble with a query. I have a Document Management system which has a security table, which has three fields docNumber, personorgroup, accessrightsI need to add a single user to a number of documents in the system. For example a select on the documents would produce results similar to the below:docNumber, personorgroup, accessrights1 person2 all2 person1 all3 person2 all3 person3 all4 person3 all5 person1 all6 person2 all6 person3 all7 person3 all8 person2 all9 person1 all9 person2 all9 person3 all10 person3 allFor every docnumber where person3 has rights, I need to add another user, person4 with the same rights to that same document.How would I go about this? Thanks very much guys in advance! |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-01-04 : 10:49:59
|
| Something like INSERT INTO yourtable (docnumber, personorgroup, accessrights)SELECT docnumber, 'person4', accessrights from yourtableWHERE personorgroup = 'person3'-------Moo. :) |
 |
|
|
cblatchford
Starting Member
40 Posts |
Posted - 2006-01-04 : 10:59:17
|
| Thanks for the swift reply, but won't that simply add an entry for every document in the table, and not just the ones where person3 has rights?For each document where a specific user has access, I need to add another user to that document..Cheers.. |
 |
|
|
cblatchford
Starting Member
40 Posts |
Posted - 2006-01-04 : 11:02:25
|
| oh hang on, i think I'm being thick.. |
 |
|
|
|
|
|
|
|