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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Advanced Insert help..

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, accessrights

I 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, accessrights
1 person2 all
2 person1 all
3 person2 all
3 person3 all
4 person3 all
5 person1 all
6 person2 all
6 person3 all
7 person3 all
8 person2 all
9 person1 all
9 person2 all
9 person3 all
10 person3 all

For 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 yourtable
WHERE personorgroup = 'person3'
-------
Moo. :)
Go to Top of Page

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..
Go to Top of Page

cblatchford
Starting Member

40 Posts

Posted - 2006-01-04 : 11:02:25
oh hang on, i think I'm being thick..
Go to Top of Page
   

- Advertisement -