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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-10-30 : 08:28:20
|
Tony writes "I have looked at all of the csv related docs on this site but none of them has enabled me to do what I need.Here is a psuedo-code example and some sample data and results of what I am looking for. I hope this makes sense. If not please let me know.Psuedo-code SPROC example:CREATE PROCEDURE GetTabs( @PageID int, @ViewRoles nvarchar(500), @EditRoles nvarchar(500))ASSELECT TabID, Title, IsEditableFROM TabsWHERE PageID = @PageIDAND one of the values in AuthViewRoles = one of the values in @ViewRolesORDER BY ViewOrderGO*Note: IsEditable should return True if one of the values in AuthEditRoles = one of the values in @EditRoles, otherwise it should return FalseSample Data:Tabs Table:TabID / PageID / ViewOrder / Title / AuthViewRoles / AuthEditRoles1 / 1 / 1 / General / Manager;Acct;Sales;CustService; / Manager;Acct;Sales;CustService;2 / 1 / 2 / Contacts / Manager;Acct;Sales;CustService; / Manager;Acct;Sales;CustService;3 / 1 / 3 / Locations / Manager;Acct;Sales;CustService; / Manager;Acct;CustService;4 / 2 / 1 / General / Manager;Acct;Sales;CustService; / Manager;Acct;Sales;CustService;5 / 2 / 2 / Forums / Manager;Acct;Sales;CustService; / Manager;6 / 1 / 5 / History / Manager;Acct;CustService; / Manager;Acct;7 / 2 / 3 / Links / Manager;Acct;Sales;CustService; / CustService;8 / 2 / 4 / FAQ / Manager;Acct;Sales;CustService; / CustService;9 / 1 / 4 / Financial / Manager;Acct; / Acct;10 / 3 / 1 / General / Manager;Acct;Sales;CustService; / Manager;Sample Results:Sample #1: @PageID = 1 @ViewRoles = 'Acct;' @EditRoles = 'Acct;' Should Return: TabID Title IsEditable 1 General True 2 Contacts True 3 Locations True 9 Financial True 6 History TrueSample #2: @PageID = 1 @ViewRoles = 'Sales;CustService;' @EditRoles = 'Sales;' Should Return: TabID Title IsEditable 1 General True 2 Contacts True 3 Locations False 6 History False There you have it. I am hoping this can be done with one sproc and using no temp tables. I guess we will see.Thanks for your help." |
|
|
|
|
|