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 |
|
timgaunt
Posting Yak Master
115 Posts |
Posted - 2004-11-11 : 11:25:51
|
| Hi,I expect this is simple and I'm just using the wrong terminology but basically what I would like to do is build a new column which contains the user's roles from the rows return from an "Access Levels" table:UsersTable:============field name data type length------------ ----------- --------U_ID int 4U_UName char 255U_UPass char 255AccessLevels:============field name data type length------------ ----------- --------AG_ID int 4AG_Name nvarchar 255AccessLevelsMatrix:============field name data type length------------ ----------- --------AG_ID int 4U_ID int 4Once the users record has been validated on the server I would simply like to return the Username and the users roles (ie can_edit, can_delete etc). In the past I have done this on the web server but now rather than having a couple of trips to the SQL Server I would like to streamline things a little.Origionally I was thinking of something like:UPDATE #TempTableSELECT [User_Roles] & [AG_Name] As [User_Roles], [U_Name] FROM #TempTable WHERE [U_Name] = @UNameBut I can't figure out the "for each row in" type statement. Any ideas?Cheers.Tim |
|
|
timgaunt
Posting Yak Master
115 Posts |
Posted - 2004-11-11 : 12:26:06
|
| Since posting I've worked out that I should have been searching on concatenate which has thrown a whole new element into the SP, so is there anyway I can concatenate multiple rows into a single column? |
 |
|
|
timgaunt
Posting Yak Master
115 Posts |
Posted - 2004-11-11 : 12:30:48
|
| Think I've found a solution thanks :) |
 |
|
|
|
|
|