| | |
Triggers Loop or Stored Procedures Loop
Please support our MS SQL advertiser: Intel Parallel Studio Home
![]() |
Hi all
The problem is the following :
I wish if some one can help me .
Thank you very much
The problem is the following :
- I am in a project that contains a table of users(user_tbl) and another table of groups(Group_tbl) . and each group can contains multi-user by Group_Id which is foreign key in user_tbl .
- I am now about creating a trigger that happens when inserting in permissions_tbl (contains users and group permissions) . It should insert all users of the inserted group into the permissions_tbl also with the same values the group taked.
- So , I need Loops very much to loop in the user_tbl and get the users of the inserted group then insert them in the permissions_tbl .
I wish if some one can help me .
Thank you very much
Life Is A Big Code
Rushdy Ibrahim
Egypt
Rushdy Ibrahim
Egypt
Boy you need to reed up on the relational model and set-theory. Loops don't belong in an RDBMS. (except in VERY exceptional circumstances)
Google or search some of these terms and start reading.
You don't need a trigger or a loop Yuck!
If you can supply more details on structure of your table and sample data, and what you need the result to be I could give you example TSQL code to do it.
Google or search some of these terms and start reading.
You don't need a trigger or a loop Yuck!
If you can supply more details on structure of your table and sample data, and what you need the result to be I could give you example TSQL code to do it.
MS SQL Syntax (Toggle Plain Text)
INSERT INTO permisions_tbl (userid) SELECT userid FROM user_tbl WHERE groupid = @groupid
![]() |
Similar Threads
- how can Stored procedures be used in oracle reports for creating reports? (Oracle)
- Monitoring changes in a MySQL DB (VB.NET)
- Loops in Sql Server Triggers and Stored Procedures (ASP.NET)
- need help with while loop (Java)
- loop problem (C++)
- Calling Oracle Stored Procedures with ASP (ASP)
Other Threads in the MS SQL Forum
- Previous Thread: inserting coloring text
- Next Thread: SQL Golf Handicap
| Thread Tools | Search this Thread |
connectingtodatabaseinuse count cursor data database datepart deadlock delete_trigger highperformancecomputing hpc hpcserver2008 ibm iis loop maximum microsoft ms mssql multithreading news number permission query reporting result server services sets source sql sqlserver sqlserver2005 supercomputing uniqueid update view






