My application uses a database in SQL Server. That database has Tables, Stored Procedures, Functions etc. Sometimes I need to give MyDatabase.MDF file to my clients. And here is the problem: I don't want to give all the tables to my clients, but only some of them. Also for some tables, I just want to give only a subset of their's columns. Not only this, I also want to change the data so that confidential information does not get out.
So what I want: I have a config file as below:
Tables that can be exported: Employees, Contact Details. Department etc. Columns that can be exported: Employees, Contact Details Columns whose data is to be changed: Employees
From above configuration file you can infer that I just want Employees, Contact Details. Department tables to be get exported (database can have other tables also). Employees have many columns but I just want Name, DateOfborth cloumns to be get exported. And I want to change the values of DateOfborth cloumn in Employees table.
So I want to create new MDF file (from the original one). That MDF files should meet some or all of the below requirements:
1 Only those tables get exported in new MDF file, that I specify in the Config file.
2 Only those cloumns get exported in new MDF file, that I specify in the Config file. If there is no entry for a particular table in the Config file, I can then export all its cloumns.
3 If there are some cloumns in Config file whose values I want to change, it should be possible.
Is it possible to achieve what I want? If all three requirements cannot be met, is it possible to meet one or two requirements? If yes, how can I do that? And Can I do that by creating a Stored Procedure (and not using C# or something else as I will prefer to use T-SQL only)