Created
September 25, 2012 21:29
-
-
Save thePunderWoman/3784573 to your computer and use it in GitHub Desktop.
BaseVehicleID Population
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @CursorVar1 CURSOR | |
DECLARE @CurrentVehicle int | |
DECLARE @CurrentYear int | |
DECLARE @CurrentMake int | |
DECLARE @CurrentModel int | |
SET @CursorVar1 = CURSOR SCROLL DYNAMIC | |
FOR | |
select AAIABaseVehicleID, AAIAYearID, AAIAMakeID, AAIAModelID from AAIABaseVehicle | |
OPEN @CursorVar1 | |
FETCH NEXT FROM @CursorVar1 INTO @CurrentVehicle, @CurrentYear, @CurrentMake, @CurrentModel | |
WHILE @@FETCH_STATUS = 0 | |
BEGIN | |
Update Application set BaseVehicleID = @CurrentVehicle | |
WHERE FromYear = @CurrentYear AND AAIAMakeID = @CurrentMake AND AAIAModelID = @CurrentModel | |
FETCH NEXT FROM @CursorVar1 INTO @CurrentVehicle, @CurrentYear, @CurrentMake, @CurrentModel | |
END | |
CLOSE @CursorVar1 | |
DEALLOCATE @CursorVar1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment