This is a bit tricky to explain, but here goes. We have a System Rights database that loads system users and system rights or access levels into two different tables. The database is already built and live with some system data populating it daily. I have been asked to build the SSIS package to populate a few new system users/rights into this database, but a couple of these systems do not have numeric fields identifying the position rights field as an id that I can populate the systemAccessLevelID field in the database with. I will try to outline what I have and what I need to do.
SystemUsers Table:
SystemID
-Int
Defined in a system tableSystemAccessLevelID
-Int
populated from SSIS pull from sourceName
-nvarchar(50)
populated from SSIS pull from source
SystemRights Table:
SystemID
-Int
Defined in a system tableSystemAccessLevelID
-Int
populated from SSIS pull from sourceSystemAccessLevelDesc
-nvarchar
populated from SSIS pull from source
The idea here is one source database that stores all of the different system users with their rights in those respective systems to be able to run audit reports against the database.
The Problem As an example in Source1 there is no numeric field that can be converted to Int to identify the Access levels for the different rights in the systems.
This has to get reloaded daily for audit purposes and the SystemAccessLevelID field needs to stay the same regardless if new system access levels are created in the source system.
I debated trying to create a function to loop through the SystemAccessLevelDesc field and converting each letter to an integer through hard coding a numeric value for every letter and special character then adding it all together, but I don't really know where to start with that. I also feel that I must be missing an existing function or process somewhere that I could use and was hoping someone could point me in the right direction.
Example Data:
SystemID, SystemAccessLevelID, SystemAccessLevelDesc
1 , %DontHave% , SYSADMIN
1 , %DontHave% , SYSACCESS
1 , %DontHave% , SYSREAD
How can I convert he different SystemAccessLevelDesc to get unique numeric values for SystemAccessLevelID? I was hoping to be able to do this with a single Select statement still which is why I was thinking the user defined function was my best route.