Is there a way that allows me to load certain data and possibly read from a database with only downloads ?
It depends on how flexible you are with the location of this "defined data" and / or PERMISSION_SET assembly.
If the assembly should remain as SAFE (which is preferable, if at all possible), then only two sources that can be read from this are external to the assembly:
- Environment Variables
- The app.config file (see my answer to this SO question for details: Does SQL Server CLR Integration support configuration files? - and yes, it also works with the
appSettings section). UPDATE: So far, it seems that reading from the configuration file does not work on Linux (new platform with SQL Server 2017).
Although none of them is "dynamic" like reading from this table, you can configure a trigger in this settings table to output the corresponding data to sqlservr.exe.config file. I would not recommend this for a table with a high transaction, but I I suppose that the values ββfor these purposes do not change so often, especially since the plan should cache them anyway in static readonly variables.
If the assembly is already installed on EXTERNAL_ACCESS , you can do regular / external SqlConnection to get data from the database. However, if this is the only reason you set the assembly to EXTERNAL_ACCESS , then I would choose the configuration file option noted above, because performance is better by deterministic methods if the assembly is set to SAFE .
source share