Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT/INSERT Question
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01478284
Message ID:
01478287
Vues:
27
>>>Assuming the following Rights table, how do you select out the right, change the RoleKey to some value, and then reinsert those rows back into this table?
>>>
>>>
>>>RightKey    RoleKey     UserKey     RightName                                          RightCode                                          AllowDeny
>>>----------- ----------- ----------- -------------------------------------------------- -------------------------------------------------- -----------
>>>27          NULL        NULL        Add User                                           sys_add_user                                       1
>>>28          NULL        NULL        Edit User                                          sys_edit_user                                      1
>>>29          NULL        NULL        Remove User                                        sys_remove_user                                    1
>>>30          NULL        NULL        Lock User                                          sys_lock_user                                      1
>>>
>>>
>>>Thanks
>>>
>>>Kevin
>>
>>The question is not clear. Do you want to just update a record, or insert a record with a different RoleKey, but the same information in other fields?
>>
>>insert into @Roles
>>(RoleKey, UserKey, etc.) select 'SomeRole', UserKey, etc. from @Roles where RightKey = @RightKey
>
>
>I want to duplicate all 4 rows, but setting the RoleKey.

Do you want to set them to the same value as my sample shows? Then the same code, just remove where condition or use where condition you need.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform