Friday, March 23, 2012
Many-To-Many
I have two tables one is a tasks table and the other an employees table. A third table I have is called participants. This third table holds the IDs of tasks and the IDs of employees assigned to complete those tasks. My problem is figuring out how to select employee IDs and names from the employees table that are not associated with a specific taskid in the participants table.
My first attampt was:
SELECT Employees.employeeid,Employees.username FROM Employees,Participants WHERE Participants.taskid=# AND Employees.employeeid!=Participants.employeeid.
#=any valid integer id in the taskid field of the Participants table.
This attempt just gave me everyone in the Employees table.
A more graphical representation of the tables:
tasks
-taskid
-task_name
-due_date
-assignment_date
employees
-employeeid
-first_name
-last_name
participants
-participantid
-taskid
-employeeid
Thanks for any input.Select *
from tableA
where id NOT IN
(Select id from tableB)sql
Monday, March 12, 2012
manipulating data before grouping & displaying
I got data with recursive data. Additionally every entry is asssigned to a specific role. But not every related child & parent doesn't have to have the same role. Usually, every child should be displayed underneath its parent, but when I group on the role, the entries get split up.Like:
Role x:
Parent 1
Child 1.1
Child 1.2
Parent 2
Role y:
Parent 3
Child 2.1
Child 2.2
Parent 4
I think you get the picture. But It should look like:
Role x:
Parent 1
Child 1.1
Child 1.2
Parent 2
Child 2.1
Child 2.2
Role y:
Parent 3
Parent 4
The easiest way I thought of, was, to manipulate the data of the child entries in the role column, so it matches the same role as their parent. Anyone got any idea of how to accomplish such a thing?
write a recursive sql cursor. Create a temp table with the a new column. For each new level add a space to the new column. So the child would get a " " and the grandchildren would get a bigger space " " and so fourth. Make sure the cursor puts the elements in the correct order as in your example above. The cursor will transfer your dataset and will load the values in the temp table. Then when you print your tree you can do something like.
newcolumn.value & node.value
Friday, March 9, 2012
Managing user rights
how can I change user right to specific DB? This must be done without stopping and restarting the service! I know this is just a basic thing to do, but I′n newbie so.... And if you are so kind that you answer, can you be quite specific with your answer.
Otherwise my boss will be behind my desk and asking me, why the whole company cant sale any products... ;() Thank You.
Hi,
You can use Enterprise manager or syetem stored procedures to change user
rights of a database.
For changing the user rights (Adding database fixed Roles / Grant prev) do
not require a service restart.
Look into the Database Fixed roles and Grant / Revoke / Deny statements in
Books online for more informations on setting previlages to users.
Since you are beginner you can perform this using the enterprise manager --
Security Option or using Enterprise manager --
Expand Databases -- Users to add or remove database fixed roles.
Thanks
Hari
MCDBA
"Atom" <anonymous@.discussions.microsoft.com> wrote in message
news:D83E0E35-F1DE-4255-81D9-8AFB9B5F7CB1@.microsoft.com...
> Hi,
> how can I change user right to specific DB? This must be done without
stopping and restarting the service! I know this is just a basic thing to
do, but In newbie so.... And if you are so kind that you answer, can you
be quite specific with your answer. Otherwise my boss will be behind my desk
and asking me, why the whole company cant sale any products... ;() Thank
You.
Managing user rights
how can I change user right to specific DB? This must be done without stopping and restarting the service! I know this is just a basic thing to do, but I´n newbie so.... And if you are so kind that you answer, can you be quite specific with your answer. Otherwise my boss will be behind my desk and asking me, why the whole company cant sale any products... ;() Thank You.Hi,
You can use Enterprise manager or syetem stored procedures to change user
rights of a database.
For changing the user rights (Adding database fixed Roles / Grant prev) do
not require a service restart.
Look into the Database Fixed roles and Grant / Revoke / Deny statements in
Books online for more informations on setting previlages to users.
Since you are beginner you can perform this using the enterprise manager --
Security Option or using Enterprise manager --
Expand Databases -- Users to add or remove database fixed roles.
Thanks
Hari
MCDBA
"Atom" <anonymous@.discussions.microsoft.com> wrote in message
news:D83E0E35-F1DE-4255-81D9-8AFB9B5F7CB1@.microsoft.com...
> Hi,
> how can I change user right to specific DB? This must be done without
stopping and restarting the service! I know this is just a basic thing to
do, but I´n newbie so.... And if you are so kind that you answer, can you
be quite specific with your answer. Otherwise my boss will be behind my desk
and asking me, why the whole company cant sale any products... ;() Thank
You.
Managing user rights
how can I change user right to specific DB? This must be done without stoppi
ng and restarting the service! I know this is just a basic thing to do, but
I′n newbie so.... And if you are so kind that you answer, can you be quite
specific with your answer.
Otherwise my boss will be behind my desk and asking me, why the whole compan
y cant sale any products... ;() Thank You.Hi,
You can use Enterprise manager or syetem stored procedures to change user
rights of a database.
For changing the user rights (Adding database fixed Roles / Grant prev) do
not require a service restart.
Look into the Database Fixed roles and Grant / Revoke / Deny statements in
Books online for more informations on setting previlages to users.
Since you are beginner you can perform this using the enterprise manager --
Security Option or using Enterprise manager --
Expand Databases -- Users to add or remove database fixed roles.
Thanks
Hari
MCDBA
"Atom" <anonymous@.discussions.microsoft.com> wrote in message
news:D83E0E35-F1DE-4255-81D9-8AFB9B5F7CB1@.microsoft.com...
> Hi,
> how can I change user right to specific DB? This must be done without
stopping and restarting the service! I know this is just a basic thing to
do, but In newbie so.... And if you are so kind that you answer, can you
be quite specific with your answer. Otherwise my boss will be behind my desk
and asking me, why the whole company cant sale any products... ;() Thank
You.