Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @DefinedValueId INT = --Update this value before running statement below
- BEGIN TRANSACTION AlphaSortDefinedValue
- Update DefinedValue
- SET [Order] = Alpha.AlphaOrder
- FROM DefinedValue DV
- JOIN (
- SELECT DV.Id, DV.[Value], DV.[Order], RANK() OVER (
- PARTITION BY DefinedTypeId ORDER BY DV.[Value] ASC
- ) AS AlphaOrder from DefinedValue DV
- where DV.DefinedTypeId = @DefinedValueId
- ) Alpha ON Alpha.[Id] = DV.[Id]
- COMMIT TRANSACTION AlphaSortDefinedValue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement