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 |
|
dkekesi
Starting Member
38 Posts |
Posted - 2011-08-12 : 09:48:56
|
| Hi Experts,I have an application where a user can set up "profiles" that contain some data. Users can also define "settings" separately and assign multiple settings to a profile. A setting can have multiple sub-settings (another type of object, different from the settings object) but no more. So this is a 3 level hierarchy (Profile->Setting->Sub-Setting). The tables are constant.I'd like to offer the users' a capability to create copies of entire profiles. That should also include the underlying hierarchy of settings and sub-settings of each setting. I planned on creating a SP that gets the ID of the profile as the input, and outputs the ID of the new profile.However, I quickly I ran into several obstacles. To make things worse I use Identity columns to generate PKs. I can create the new profile and I can also duplicate the appropriate records of the "Settings" table (simple 'select into'), but for my life I can't figure out how to duplicate all sub-settings... and this is where I am for the last two days: scratching my head.The problem lies with the PKs in the settings table being only available after insertion of copied rows.I use MS SQL 2008R2 and develop in C# and VB.NET. If the problem can only be solved by SQLCRL then I am willing to sacrifice DB independency.Any help is most appreciated.Best Regards,Daniel |
|
|
dkekesi
Starting Member
38 Posts |
Posted - 2011-08-16 : 04:17:06
|
| Nobody? Hmm... I did not think this was so hard for the pros.Best Regards,Daniel |
 |
|
|
|
|
|