How to stop a slideshow and show another movie clip at the end?

Currently my slideshow is in a loop. At the end of last slideshow, I want to show another movie clip (End_mv) that's on another layer. How do I do that? My current scripts are below:
import fl.transitions.Tween;
import fl.transitions.easing.*;
//change scale on an image
var fadeTween:Tween;
//To slide in on X axis
var slideXTween:Tween;
//To slide in on Y axis
var slideYTween:Tween;
//To fade IN
var alphaTween:Tween;
//To get bigger on its X axis
var scaleXTween:Tween;
//To get bigger on its Y axis
var scaleYTween:Tween;
//var fadeTween:Tween;
//description place holder
var strDescrp:String;
//source place holder
var strSource:String;
//x poistion
var posX:Number;
//y position
var posY:Number;
//degree rotation
var degreeRot:Number;
// delay between slides
//const TIMER_DELAY:int = 5000;
var TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:int = 3;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// url to slideshow xml
var strXMLPath:String = "lstHouse.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
var txtField:TextField = new TextField();
var formatText:TextFormat = new TextFormat();
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("PaukenBrumfiel_AngelsOnHigh.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
    sound.play();
function init():void
    // create new urlloader for xml file
    xmlLoader = new URLLoader();
    // add listener for complete event
    xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
    // load xml file
    xmlLoader.load(new URLRequest(strXMLPath));
    // create new timer with delay from constant
    slideTimer = new Timer(TIMER_DELAY);
    // add event listener for timer event
    slideTimer.addEventListener(TimerEvent.TIMER, switchSlide);
    // create 2 container sprite which will hold the slides and
    // add them to the masked movieclip
    sprContainer1 = new Sprite();
    sprContainer2 = new Sprite();   
    mcSlideHolder.addChild(sprContainer1);
    mcSlideHolder.addChild(sprContainer2);
    // keep a reference of the container which is currently
    // in the front
    currentContainer = sprContainer2;
function onXMLLoadComplete(event:Event):void
    // create new xml with the received data
    xmlSlideshow = new XML(event.target.data);
    // get total slide count
    intSlideCount = xmlSlideshow..image.length();
    // switch the first slide without a delay
    switchSlide(null);
function fadeSlideIn(e:Event):void {
    // add loaded slide from slide loader to the
    // current container
    currentContainer.addChild(slideLoader.content);
    // clear preloader text
    //mcInfo.lbl_loading.text = "";
    // fade the current container in and start the slide timer
    // when the tween is finished
    //Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:function() { slideTimer.start(); }});       
    //strSource = xmlSlideshow.image[intCurrentSlide].@src;
    fadeTween = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
    //scale = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
    slideTimer.start()
    onComplete:function();
function switchSlide(e:Event):void
    // check, if the timer is running (needed for the
    // very first switch of the slide)
    if(slideTimer.running)
        slideTimer.stop();
    // check if we have any slides left and increment
    // current slide index
    if(intCurrentSlide + 1 < intSlideCount)
        intCurrentSlide++;
    // if not, start slideshow from beginning
    else
        intCurrentSlide = 0;
    // check which container is currently in the front and
    // assign currentContainer to the one that's in the back with
    // the old slide
    if(currentContainer == sprContainer2)
        currentContainer = sprContainer1;
    else
        currentContainer = sprContainer2;
    // hide the old slide
    currentContainer.alpha = 0;
    // bring the old slide to the front
    mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
    strDescrp = xmlSlideshow.image[intCurrentSlide].@desc;
    //strSource = xmlSlideshow.image[intCurrentSlide].@src;
    //txtField.border = true;
    //txtField.x = 0;
    //txtField.y = 600;
    txtField.width = 855;
    txtField.height = 200;   
    //txtField.background = true;
    //txtField.backgroundColor = 0xEE9A00;
    txtField.alpha = 20;
    txtField.text = strDescrp;
    formatText.align = TextFormatAlign.CENTER;
    //txtField.autoSize = TextFieldAutoSize.LEFT;
    formatText.color = 0x000;
    formatText.size = 30;
    txtField.x = 0;
    txtField.y = 550;
    posX = 0;
    posY = 0;
    degreeRot = 0;
    // create a new loader for the slide
    slideLoader = new Loader();
    // add event listener when slide is loaded
    slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
    // load the next slide
    slideLoader.load(new URLRequest(xmlSlideshow.image[intCurrentSlide].@src));   
    addChild(txtField);
    txtField.setTextFormat(formatText)
// init slideshow
init();

I got this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/swapChildren()
    at University_Advancement_Holiday_Greeting2012_fla::MainTimeline/switchSlide()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
And here's the code:
// import tweener
//import caurina.transitions.Tweener;
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
//change scale on an image
var fadeTween:Tween;
//To slide in on X axis
var slideXTween:Tween;
//To slide in on Y axis
var slideYTween:Tween;
//To fade IN
var alphaTween:Tween;
//To get bigger on its X axis
var scaleXTween:Tween;
//To get bigger on its Y axis
var scaleYTween:Tween;
//var fadeTween:Tween;
//description place holder
var strDescrp:String;
//source place holder
var strSource:String;
//x poistion
var posX:Number;
//y position
var posY:Number;
//degree rotation
var degreeRot:Number;
// delay between slides
//const TIMER_DELAY:int = 5000;
var TIMER_DELAY:int = 5000;
// fade time between slides
const FADE_TIME:int = 3;
// reference to the current slider container
var currentContainer:Sprite;
// index of the current slide
var intCurrentSlide:int = -1;
// total slides
var intSlideCount:int;
// timer for switching slides
var slideTimer:Timer;
// slides holder
var sprContainer1:Sprite;
var sprContainer2:Sprite;
// slides loader
var slideLoader:Loader;
// url to slideshow xml
var strXMLPath:String = "lstHouse.xml";
// slideshow xml loader
var xmlLoader:URLLoader;
// slideshow xml
var xmlSlideshow:XML;
var txtField:TextField = new TextField();
var formatText:TextFormat = new TextFormat();
//var myEnding:MovieClip = stage.getChildByName('End_mc') as MovieClip;
//start of sound section is for sound
var soundReq:URLRequest = new URLRequest("PaukenBrumfiel_AngelsOnHigh.mp3");
var sound:Sound = new Sound();
sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
//end of sound section
function onComplete(event:Event):void
    sound.play();
function init():void
    //reference my movie clip "End_mc" oon the stage and turn its visibility off
    MovieClip(getChildByName('End_mc')).visible = false;
    // create new urlloader for xml file
    xmlLoader = new URLLoader();
    // add listener for complete event
    xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete);
    // load xml file
    xmlLoader.load(new URLRequest(strXMLPath));
    // create new timer with delay from constant
    slideTimer = new Timer(TIMER_DELAY);
    // add event listener for timer event
    slideTimer.addEventListener(TimerEvent.TIMER, switchSlide);
    // create 2 container sprite which will hold the slides and
    // add them to the masked movieclip
    sprContainer1 = new Sprite();
    sprContainer2 = new Sprite();   
    mcSlideHolder.addChild(sprContainer1);
    mcSlideHolder.addChild(sprContainer2);
    // keep a reference of the container which is currently
    // in the front
    currentContainer = sprContainer2;
//function onXMLLoadComplete(e:Event):void
function onXMLLoadComplete(event:Event):void
    // create new xml with the received data
    xmlSlideshow = new XML(event.target.data);
    // get total slide count
    intSlideCount = xmlSlideshow..image.length();
    // switch the first slide without a delay
    switchSlide(null);
function fadeSlideIn(e:Event):void {
    // add loaded slide from slide loader to the
    // current container
    currentContainer.addChild(slideLoader.content);
    // clear preloader text
    //mcInfo.lbl_loading.text = "";
    // fade the current container in and start the slide timer
    // when the tween is finished
    //Tweener.addTween(currentContainer, {alpha:1, time:FADE_TIME, onComplete:function() { slideTimer.start(); }});       
    //strSource = xmlSlideshow.image[intCurrentSlide].@src;
    fadeTween = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
    //scale = new Tween(currentContainer, "alpha", Regular.easeInOut, 0, 1, 2, true)
    slideTimer.start()
    onComplete:function();
function switchSlide(e:Event):void
    // check, if the timer is running (needed for the
    // very first switch of the slide)
    if(slideTimer.running)
        slideTimer.stop();
    // ADDED: Check if using sprContainer2 and at the last slide
    //if ((currentContainer == sprContainer2) && (intCurrentSlide == intSlideCount))
    trace("Current Slide: " + intCurrentSlide);
    trace("SlideCount: " + intSlideCount);
    if ((currentContainer == sprContainer2) && ((intCurrentSlide + 1) == intSlideCount))
        // hide the slideshow (and other related elements, or remove them if desired)
        //mcSlideHolder.visible = false;
        // remove any clips directly inside slideshow (any timers/etc need to be stopped too)
         while (mcSlideHolder.numChildren > 0)
            mcSlideHolder.removeChildAt(0);
        // I do see a var named 'sound' playing so you might want to:
         //sound.stop();
         //sound = null;
        // etc any other slideshow-only elements to hide/remove..
        // play your movie
        MovieClip(getChildByName('End_mc')).visible = true;
        MovieClip(getChildByName('End_mc')).play();       
    // check if we have any slides left and increment
    // current slide index
    if(intCurrentSlide + 1 < intSlideCount)
        intCurrentSlide++;
    // if not, start slideshow from beginning
    else
        intCurrentSlide = 0;
    // check which container is currently in the front and
    // assign currentContainer to the one that's in the back with
    // the old slide
    if(currentContainer == sprContainer2)
        currentContainer = sprContainer1;
    else
        currentContainer = sprContainer2;
    // hide the old slide
    currentContainer.alpha = 0;
    // bring the old slide to the front
    mcSlideHolder.swapChildren(sprContainer2, sprContainer1);
    strDescrp = xmlSlideshow.image[intCurrentSlide].@desc;
    //strSource = xmlSlideshow.image[intCurrentSlide].@src;
    //txtField.border = true;
    //txtField.x = 0;
    //txtField.y = 600;
    txtField.width = 855;
    txtField.height = 200;   
    //txtField.background = true;
    //txtField.backgroundColor = 0xEE9A00;
    txtField.alpha = 20;
    txtField.text = strDescrp;
    formatText.align = TextFormatAlign.CENTER;
    //txtField.autoSize = TextFieldAutoSize.LEFT;
    formatText.color = 0x000;
    formatText.size = 30;
    txtField.x = 0;
    txtField.y = 550;
    posX = 0;
    posY = 0;
    degreeRot = 0;
    // create a new loader for the slide
    slideLoader = new Loader();
    // add event listener when slide is loaded
    slideLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, fadeSlideIn);
    // add event listener for the progress
    //slideLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
    // load the next slide
    slideLoader.load(new URLRequest(xmlSlideshow.image[intCurrentSlide].@src));   
    addChild(txtField);
    txtField.setTextFormat(formatText)   
// init slideshow
init();

Similar Messages

  • Using Events To Play Another Movie Clip

    Dear Readers:
    I have a set of buttons in my flash movie that, when a mouse
    cursor passes over it, another movie clip on the stage causes a
    layer with text to gradually appear from below. It pops up, so to
    speak, and eventually stops, displaying the text related to the
    button in full view.
    Passing over a different button causes the text layer to move
    downward, slowly disappear off the stage, then reappear in the same
    manner with text associated with that latest button. Its fairly
    simple and works fine, as long as the user waits patiently for the
    text layer to scroll down and back up before passing over another
    button. See code below.
    However, if the user decides to quickly pass over multiple
    buttons (before the text layer reaches the top), the event handler
    is coded such that if the mouseover event occurs BEFORE the text
    layer reaches the top, the text layer starts over at the bottom, so
    the transition is not smooth. Imagine the text layer just about to
    reach the top, when the mouseover event occurs, now the text layer
    starts over from the bottom. Very choppy.
    I'd like to grab the current frame of the text layer movie
    clip when the mouseover event occurs, and have the layer move back
    down from there, reach the bottom, then come back up, rather than
    starting from the bottom. Any help in coming would be great. Thanks
    in advance.

    yourI = setInterval(f,t) starts a loop. it repeatedly calls
    the function f() every t milliseconds until a clearInterval(yourI)
    is executed.
    the most common problem that occurs with setInterval() is
    executing it twice (or more) with no intervening clearInterval().
    when that happens all hell breaks loose and the swf will call the
    function much more rapidly than intended and can not be (easily)
    stopped no matter how many clearInterval() statements you try and
    execute.
    the easiest way to prevent that problem is to execute a
    clearInterval() just BEFORE all setInterval() statements. it
    doesn't hurt anything to (try and) clear and interval that doesn't
    exist and occasionally it'll stop the seemingly bizarre problems
    that occur with out-of-control intervals:
    clearInterval(yourI);
    yourI=setInterval(f,t);

  • I am trying to create an executable vi that will call out another vi and show its front panel in the executable​. When I try this I recieve this error message "top level vi (my main vi) was stopped at unknown on the block diagram of (my sub vi)

    I am trying to create an executable vi that will call out another vi and show its front panel in the executable.  When I try this I recieve this error message "top level vi (my main vi) was stopped at unknown on the block diagram of (my sub vi)

    Well the most common way is to enclude the vi's in the build spec either directly in the dependancies that the App builder automatically generates OR by declaring them in the build spec as "additional enclusions" (like you must do for dynamic vi calls in your app.
    I have heard rummors about My.app Stuff.vi in a nugget Intaris posted- and I've wanted to dig deaper into Intaris' claims- but have not tried it myself.
    If you go down the stuff.vi route Keep us curious guys posted
    Jeff

  • How can i use this sript and loade another movie?

    Hi there, i used the following script to load a movie from the server;
    var request:URLRequest = new URLRequest("url string");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    How can i use this sript and loade another movie? Can someone help me please?
    [edited by moderator]

    Sir, I changed it from:
    var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Dir.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    to
    var request:URLRequest = new URLRequest("http://agusandelsur.gov.ph/downloads/pdrrmo/agusan_del_sur/StaJosefa/Movies/Warning.swf");
    var loader:Loader = new Loader()
    loader.load(request);
    addChild(loader);
    When i expord the movie i get the following error.....
    Scene 1, Layer 'Layer 3', Frame 1, Line 6    1151: A conflict exists with definition request in namespace internal.

  • How to Handle and show multiple pushpin imgaes on the map based on the requirement at different coordintes?

    How to Handle and show multiple pushpin imgaes on the map based on the requirement at different coordintes?
    I have multiple images in  my App folder. I want to use and show those images dynamically  in windows phone 8 map application

    There are a lot of different ways to do this. One simple method is to use a switch statement when creating your pushpins and based on some property in your data, select the icon you want to use and create your pushpin accordingly.
    http://rbrundritt.wordpress.com

  • How to drop a schema and load another one?

    I have an interruption during installing the central instance of a SAP Netweaver 04s System. After I restarted the installation I found this message in the Log file.
    <b>ERROR 2006-08-16 16:17:04</b>
    CJS-30109 The Java load in database PDV/liesc1ddbw01 has already been configured. <p> SOLUTION: Drop the schema and load it with a new load before running this installation.
    <b>ERROR 2006-08-16 16:17:04</b>
    CJS-30109  The Java load in database PDV/liesc1ddbw01 has already been configured. <p> SOLUTION: Drop the schema and load it with a new load before running this installation.
    <b>ERROR 2006-08-16 16:17:04</b>
    FCO-00011  The step getJavaLoadType with step key |NW_Java_CI|ind|ind|ind|ind|0|0|NW_CI_Instance|ind|ind|ind|ind|10|0|getJavaLoadType was executed with status ERROR.
    QUESTION: How to drop a schema and load another one?

    Hello,
    I got the similar error....but i did reinstall from o.s. and done the installation again...it was worked successfully..
    if you find out alternate solution for that ...please let us know..
    Regards,

  • How to create a form and show it as a modal window in VB6?

    oform.modal  -> modal is read-only property
    help,please.

    Hi Santiago!
    HTH: How to create a form and show it as a modal window?

  • How to stop iphone 4s from showing last picture taken upon taking a new picture even if last picture was deleted

    how to stop iphone 4s from showing last picture taken upon taking a new picture even if last picture was deleted?

    how to stop iphone 4s from showing last picture taken upon taking a new picture even if last picture was deleted?

  • My ipad mini fades out, freezes and shows streaks of lines on the screen. What is the problem or how can this be fixed?

    my ipad mini fades out, freezes and shows streaks of lines on the screen. What is the problem or how can this be fixed?

    try reseting the device
    try restoring the device as new
    then replace

  • I ned help please, I am losing storage space on my iPhone 6 and I am not downloading anything nor upgrading but still my storage dwindles literally by the hour , does anyone know as to why and if so how to stop this please and thank you.

    I ned help please, I am losing storage space on my iPhone 6 and I am not downloading anything nor upgrading but still my storage dwindles literally by the hour , does anyone know as to why and if so how to stop this please and thank you.

    Did you tried any of these basic troubleshooting steps?
    Restart / Reset
    http://support.apple.com/en-us/HT201559
    Restore from backup
    Restore as new
    http://support.apple.com/en-us/HT201252

  • How to add a "Create and Create Another" button to form

    I have an input form on a table with several LOV select lists and a text field. To ease data entry, the user wants to create several records, one at a time, by remaining on the same form page. Built-in APEX functionality adds the record and returns the user to the report page.
    User wants to create the first record by clicking the Create button, stay on the form with all the LOV values as they were (not clearing cache), change one or two LOV choices and the text field, and click a "Create and Create Another" button. The user will stay on the form until clicking the "Cancel" button.
    I changed the branch on the form to call itself. The LOV and text field values remain, but the "Create" button disappears to add another. Of course, I'll need to run the Get PK process to get the next sequence number for the new record.
    Looking for the best way to accomplish this. Thanks!

    If it is using the default setup, I believe you would clear the PK field (and now others) on branch to same for "Create and Create Another", as that is the default criteria for whether the Create button is shown.

  • How to use direct select and insert or load to speedup the process instead of cursur

    Hi friends,
    I have stored procedure .In SP i am using cursur to load data from Parent to several child table.
    I have attached the script with this message.
    And my problem is how to use direct select and insert or load to speedup the process instead of cursur.
    Can any one please suggest me how to change this scripts pls.
    USE [IconicMarketing]
    GO
    /****** Object: StoredProcedure [dbo].[SP_DMS_INVENTORY] Script Date: 3/6/2015 3:34:03 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author: <ARUN,NAGARAJ>
    -- Create date: <11/21/2014>
    -- Description: <STORED PROCEDURE FOR DMS_INVENTORY>
    -- =============================================
    ALTER PROCEDURE [dbo].[SP_DMS_INVENTORY]
    @Specific_Date varchar(20) ,
    @DealerNum Varchar(6),
    @Date_Daily varchar(50)
    AS
    BEGIN
    SET NOCOUNT ON;
    --==========================================================================
    -- INVENTORY_CURSUR
    --==========================================================================
    DECLARE
    @FileType varchar(50),
    @ACDealerID varchar(50),
    @ClientDealerID varchar(50),
    @DMSType varchar(50),
    @StockNumber varchar(50),
    @InventoryDate datetime ,
    @StockType varchar(100),
    @DMSStatus varchar(50),
    @InvoicePrice numeric(18, 2),
    @CostPack varchar(50),
    @SalesCost numeric(18, 2),
    @HoldbackAmount numeric(18, 2),
    @ListPrice numeric(18, 2),
    @MSRP varchar(max),
    @LotLocation varchar(50),
    @TagLine varchar(max),
    @Certification varchar(max),
    @CertificationNumber varchar(max),
    @VehicleVIN varchar(50),
    @VehicleYear bigint ,
    @VehicleMake varchar(50),
    @VehicleModel varchar(50),
    @VehicleModelCode varchar(50),
    @VehicleTrim varchar(50),
    @VehicleSubTrimLevel varchar(max),
    @Classification varchar(max),
    @TypeCode varchar(100),
    @VehicleMileage bigint ,
    @EngineCylinderCount varchar(10) ,
    @TransmissionType varchar(50),
    @VehicleExteriorColor varchar(50),
    @VehicleInteriorColor varchar(50),
    @CreatedDate datetime ,
    @LastModifiedDate datetime ,
    @ModifiedFlag varchar(max),
    @InteriorColorCode varchar(50),
    @ExteriorColorCode varchar(50),
    @PackageCode varchar(50),
    @CodedCost varchar(50),
    @Air varchar(100),
    @OrderType varchar(max),
    @AgeDays bigint ,
    @OutstandingRO varchar(50),
    @DlrAccessoryRetail varchar(50),
    @DlrAccessoryCost varchar(max),
    @DlrAccessoryDesc varchar(max),
    @ModelDesc varchar(50),
    @Memo1 varchar(1000),
    @Memo2 varchar(max),
    @Weight varchar(max),
    @FloorPlan numeric(18, 2),
    @Purchaser varchar(max),
    @PurchasedFrom varchar(max),
    @InternetPrice varchar(50),
    @InventoryAcctDollar numeric(18, 2),
    @VehicleType varchar(50),
    @DealerAccessoryCode varchar(50),
    @AllInventoryAcctDollar numeric(18, 2),
    @BestPrice varchar(50),
    @InStock bigint ,
    @AccountingMake varchar(50),
    @GasDiesel varchar(max),
    @BookValue varchar(10),
    @FactoryAccessoryDescription varchar(max),
    @TotalReturn varchar(10),
    @TotalCost varchar(10),
    @SS varchar(max),
    @VehicleBody varchar(max),
    @StandardEquipment varchar(max),
    @Account varchar(max),
    @CalculatedPrice varchar(10),
    @OriginalCost varchar(10),
    @AccessoryCore varchar(10),
    @OtherDollar varchar(10),
    @PrimaryBookValue varchar(10),
    @AmountDue varchar(10),
    @LicenseFee varchar(10),
    @ICompany varchar(max),
    @InvenAcct varchar(max),
    @Field23 varchar(max),
    @Field24 varchar(max),
    @SalesCode bigint,
    @BaseRetail varchar(10),
    @BaseInvAmt varchar(10),
    @CommPrice varchar(10),
    @Price1 varchar(10),
    @Price2 varchar(10),
    @StickerPrice varchar(10),
    @TotInvAmt varchar(10),
    @OptRetail varchar(max),
    @OptInvAmt varchar(10),
    @OptCost varchar(10),
    @Options1 varchar(max),
    @Category varchar(max),
    @Description varchar(max),
    @Engine varchar(max),
    @ModelType varchar(max),
    @FTCode varchar(max),
    @Wholesale varchar(max),
    @Retail varchar(max),
    @Draft varchar(max),
    @myerror varchar(500),
    @Inventoryid int,
    @errornumber int,
    @errorseverity varchar(500),
    @errortable varchar(50),
    @errorstate int,
    @errorprocedure varchar(500),
    @errorline varchar(50),
    @errormessage varchar(1000),
    @Invt_Id int,
    @flatfile_createddate datetime,
    @FtpDate date,
    @Inv_cur varchar(1000),
    @S_Year varchar(4),
    @S_Month varchar(2),
    @S_Date varchar(2),
    @Date_Specfic varchar(50),
    @Param_list nvarchar(max),
    @Daily_Date Varchar(50);
    --====================================================================================
    --DECLARE CURSUR FOR SPECIFIC DATE (OR) DEALER-ID WITH SPECIFIC DATE (OR) CURRENT DATE
    --====================================================================================
    set @Date_Specfic = Substring(@Specific_Date,1,4) +'-'+Substring(@Specific_Date,5,2)+'-'+Substring(@Specific_Date,7,2);
    set @Daily_Date = SUBSTRING(@Date_Daily,14,4) + '-' + SUBSTRING(@Date_Daily,18,2)+ '-' + SUBSTRING(@date_Daily,20,2)
    IF @Daily_Date IS NOT NULL
    BEGIN
    Delete From [dbo].[DMS_INVENTORY_DETAILS]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[DMS_INVENTORY_AMOUNT]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
    Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[DMS_INVENTORY_VEHICLE]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
    Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    Delete From [dbo].[DMS_INVENTORY]
    Where ID in(select ID from [dbo].[DMS_INVENTORY] where CONVERT (date,FtpDate)=CONVERT (date,GETDATE()));
    DECLARE Inventory_Cursor CURSOR FOR
    SELECT * from [dbo].[FLATFILE_INVENTORY] where
    CONVERT (date,flatfile_createddate) = CONVERT (date,GETDATE()) order by flatfile_createddate;
    END
    Else
    BEGIN
    if (@Date_Specfic IS NOT NULL AND @DealerNum != '?????')
    BEGIN
    Delete From [dbo].[DMS_INVENTORY_DETAILS]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[DMS_INVENTORY_AMOUNT]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
    Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[DMS_INVENTORY_VEHICLE]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
    Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    Delete From [dbo].[DMS_INVENTORY]
    Where ID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic AND DMSDealerID='ACTEST' + @DealerNum);
    DECLARE Inventory_Cursor CURSOR FOR
    SELECT * from [dbo].[FLATFILE_INVENTORY] where FtpDate=@Date_Specfic AND ACDealerID='ACTEST' + @DealerNum;
    END
    ELSE
    BEGIN
    Delete From [dbo].[DMS_INVENTORY_DETAILS]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[DMS_INVENTORY_AMOUNT]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[ICONIC_INVENTORY_VEHICLE]
    Where DMSInventoryVehicleID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[DMS_INVENTORY_VEHICLE]
    Where DMSInventoryID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[ICONIC_EQUITY_INVENTORY_COMPARE]
    Where InventoryVehicleId in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    Delete From [dbo].[DMS_INVENTORY]
    Where ID in(select ID from [dbo].[DMS_INVENTORY] where FtpDate=@Date_Specfic);
    DECLARE Inventory_Cursor CURSOR FOR
    SELECT * from [dbo].[FLATFILE_INVENTORY] where FtpDate=@Date_Specfic;
    END
    END
    OPEN Inventory_Cursor
    FETCH NEXT FROM Inventory_Cursor
    INTO
    @FileType ,
    @ACDealerID ,
    @ClientDealerID ,
    @DMSType ,
    @StockNumber ,
    @InventoryDate ,
    @StockType ,
    @DMSStatus ,
    @InvoicePrice ,
    @CostPack ,
    @SalesCost ,
    @HoldbackAmount ,
    @ListPrice ,
    @MSRP ,
    @LotLocation ,
    @TagLine ,
    @Certification ,
    @CertificationNumber ,
    @VehicleVIN ,
    @VehicleYear ,
    @VehicleMake ,
    @VehicleModel ,
    @VehicleModelCode ,
    @VehicleTrim ,
    @VehicleSubTrimLevel ,
    @Classification ,
    @TypeCode ,
    @VehicleMileage ,
    @EngineCylinderCount ,
    @TransmissionType ,
    @VehicleExteriorColor ,
    @VehicleInteriorColor ,
    @CreatedDate ,
    @LastModifiedDate ,
    @ModifiedFlag ,
    @InteriorColorCode ,
    @ExteriorColorCode ,
    @PackageCode ,
    @CodedCost ,
    @Air ,
    @OrderType ,
    @AgeDays ,
    @OutstandingRO ,
    @DlrAccessoryRetail ,
    @DlrAccessoryCost ,
    @DlrAccessoryDesc ,
    @ModelDesc ,
    @Memo1 ,
    @Memo2 ,
    @Weight ,
    @FloorPlan ,
    @Purchaser ,
    @PurchasedFrom ,
    @InternetPrice ,
    @InventoryAcctDollar ,
    @VehicleType ,
    @DealerAccessoryCode ,
    @AllInventoryAcctDollar ,
    @BestPrice ,
    @InStock ,
    @AccountingMake ,
    @GasDiesel ,
    @BookValue ,
    @FactoryAccessoryDescription ,
    @TotalReturn ,
    @TotalCost ,
    @SS ,
    @VehicleBody ,
    @StandardEquipment ,
    @Account ,
    @CalculatedPrice ,
    @OriginalCost ,
    @AccessoryCore ,
    @OtherDollar ,
    @PrimaryBookValue ,
    @AmountDue ,
    @LicenseFee ,
    @ICompany ,
    @InvenAcct ,
    @Field23 ,
    @Field24 ,
    @SalesCode ,
    @BaseRetail ,
    @BaseInvAmt ,
    @CommPrice ,
    @Price1 ,
    @Price2 ,
    @StickerPrice ,
    @TotInvAmt ,
    @OptRetail ,
    @OptInvAmt ,
    @OptCost ,
    @Options1 ,
    @Category ,
    @Description ,
    @Engine ,
    @ModelType ,
    @FTCode ,
    @Wholesale ,
    @Retail ,
    @Draft ,
    @flatfile_createddate,
    @FtpDate;
    WHILE @@FETCH_STATUS = 0
    BEGIN
    --==========================================================================
    -- INSERT INTO INVENTORY (PARENT TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY]
    DMSDealerID,
    StockNumber,
    DMSType,
    InventoryDate,
    FtpDate
    VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate,@FtpDate);
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errortable = 'DMS_INVENTORY',
    @errorstate = ERROR_STATE(),
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    -- PRINT @errornumber;
    -- PRINT @errorseverity;
    -- PRINT @errortable;
    -- PRINT @errorprocedure;
    -- PRINT @errorline;
    -- PRINT @errormessage;
    -- PRINT @errorstate;
    set @myerror = @@ERROR;
    -- This -- PRINT statement -- PRINTs 'Error = 0' because
    -- @@ERROR is reset in the IF statement above.
    -- PRINT N'Error = ' + @myerror;
    set @Inventoryid = scope_identity();
    -- PRINT @Inventoryid;
    --==========================================================================
    -- INSERT INTO DMS_INVENTORY_DETAILS (CHILD TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY_DETAILS]
    DMSInventoryID,
    StockType,
    DMSStatus,
    LotLocation,
    TagLine,
    Certification,
    CertificationNumber,
    CreatedDate,
    LastModifiedDate,
    ModifiedFlag,
    PackageCode,
    OrderType,
    AgeDays,
    OutstandingRO,
    Memo1,
    Memo2,
    Purchaser,
    PurchasedFrom,
    DealerAccessoryCode,
    InStock,
    AccountingMake,
    SS,
    Account,
    AccessoryCore,
    ICompany,
    InvenAcct,
    Field23,
    Field24,
    SalesCode,
    Draft,
    FTCode,
    FtpDate
    VALUES (
    @InventoryID,
    @StockType,
    @DMSStatus,
    @LotLocation,
    @TagLine,
    @Certification,
    @CertificationNumber,
    @CreatedDate,
    @LastModifiedDate,
    @ModifiedFlag,
    @PackageCode,
    @OrderType,
    @AgeDays,
    @OutstandingRO,
    @Memo1,
    @Memo2,
    @Purchaser,
    @PurchasedFrom,
    @DealerAccessoryCode,
    @InStock,
    @AccountingMake,
    @SS,
    @Account,
    @AccessoryCore,
    @ICompany,
    @InvenAcct,
    @Field23,
    @Field24,
    @SalesCode,
    @Draft,
    @FTCode,
    @FtpDate
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errorstate = ERROR_STATE(),
    @errortable = 'DMS_INVENTORY_DETAILS',
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXECUTE [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    --==========================================================================
    -- INSERT INTO DMS_INVENTORY_AMOUNT (CHILD TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY_AMOUNT]
    DMSInventoryID,
    AllInventoryAcctDollar,
    OtherDollar,
    PrimaryBookValue,
    AmountDue,
    LicenseFee,
    CalculatedPrice,
    OriginalCost,
    BookValue,
    TotalReturn,
    TotalCost,
    DlrAccessoryRetail,
    DlrAccessoryCost,
    DlrAccessoryDesc,
    InternetPrice,
    InventoryAcctDollar,
    BestPrice,
    Weight,
    FloorPlan,
    CodedCost,
    InvoicePrice,
    CostPack,
    SalesCost,
    HoldbackAmount,
    ListPrice,
    MSRP,
    BaseRetail,
    BaseInvAmt,
    CommPrice,
    Price1,
    Price2,
    StickerPrice,
    TotInvAmt,
    OptRetail,
    OptInvAmt,
    OptCost,
    Wholesale,
    Retail,
    FtpDate
    VALUES (
    @InventoryID,
    @AllInventoryAcctDollar,
    @OtherDollar,
    @PrimaryBookValue,
    @AmountDue,
    @LicenseFee,
    @CalculatedPrice,
    @OriginalCost,
    @BookValue,
    @TotalReturn,
    @TotalCost,
    @DlrAccessoryRetail,
    @DlrAccessoryCost,
    @DlrAccessoryDesc,
    @InternetPrice,
    @InventoryAcctDollar,
    @BestPrice,
    @Weight,
    @FloorPlan,
    @CodedCost,
    @InvoicePrice,
    @CostPack,
    @SalesCost,
    @HoldbackAmount,
    @ListPrice,
    @MSRP,
    @BaseRetail,
    @BaseInvAmt,
    @CommPrice,
    @Price1,
    @Price2,
    @StickerPrice,
    @TotInvAmt,
    @OptRetail,
    @OptInvAmt,
    @OptCost,
    @Wholesale,
    @Retail,
    @FtpDate
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errortable = 'DMS_INVENTORY_AMOUNT',
    @errorstate = ERROR_STATE(),
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    --==========================================================================
    -- INSERT INTO DMS_INVENTORY_VEHICLE (CHILD TABLE)
    --==========================================================================
    BEGIN TRY
    INSERT INTO [dbo].[DMS_INVENTORY_VEHICLE]
    DMSInventoryID,
    InteriorColorCode,
    ExteriorColorCode,
    Air,
    ModelDesc,
    VehicleType,
    VehicleVIN,
    VehicleYear,
    VehicleMake,
    VehicleModel,
    VehicleModelCode,
    VehicleTrim,
    VehicleSubTrimLevel,
    Classification,
    TypeCode,
    VehicleMileage,
    FtpDate,
    EngineCylinderCount
    VALUES (
    @InventoryID,
    @InteriorColorCode,
    @ExteriorColorCode,
    @Air,
    @ModelDesc,
    @VehicleType,
    @VehicleVIN,
    @VehicleYear,
    @VehicleMake,
    @VehicleModel,
    @VehicleModelCode,
    @VehicleTrim,
    @VehicleSubTrimLevel,
    @Classification,
    @TypeCode,
    @VehicleMileage,
    @FtpDate,
    @EngineCylinderCount
    END TRY
    BEGIN CATCH
    SELECT
    @errornumber = ERROR_NUMBER(),
    @errorseverity = ERROR_SEVERITY(),
    @errortable = 'DMS_INVENTORY_VEHICLE',
    @errorstate = ERROR_STATE(),
    @errorprocedure = ERROR_PROCEDURE(),
    @errorline = ERROR_LINE(),
    @errormessage = ERROR_MESSAGE();
    --==========================================================================
    -- INSERT ERRORS INTO DMSLOG_INVENTORY_ERROR
    --==========================================================================
    EXEC [SP_DMS_INVENTORY_ERROR] @FileType,@ACDealerID,@ClientDealerID,@DMSType,@StockNumber,@InventoryDate,@StockType,@DMSStatus,@InvoicePrice,@CostPack,
    @SalesCost,@HoldbackAmount,@ListPrice,@MSRP,@LotLocation,@TagLine,@Certification,@CertificationNumber,@VehicleVIN,@VehicleYear,@VehicleMake,@VehicleModel,@VehicleModelCode,
    @VehicleTrim,@VehicleSubTrimLevel,@Classification,@TypeCode,@VehicleMileage,@EngineCylinderCount,@TransmissionType,@VehicleExteriorColor,@VehicleInteriorColor,
    @CreatedDate,@LastModifiedDate,@ModifiedFlag,@InteriorColorCode,@ExteriorColorCode,@PackageCode,@CodedCost,@Air,@OrderType,@AgeDays,@OutstandingRO,
    @DlrAccessoryRetail,@DlrAccessoryCost,@DlrAccessoryDesc,@ModelDesc,@Memo1,@Memo2,@Weight,@FloorPlan,@Purchaser,@PurchasedFrom,@InternetPrice,
    @InventoryAcctDollar,@VehicleType,@DealerAccessoryCode,@AllInventoryAcctDollar,@BestPrice,@InStock,@AccountingMake,@GasDiesel,@BookValue,
    @FactoryAccessoryDescription,@TotalReturn,@TotalCost,@SS,@VehicleBody,@StandardEquipment,@Account,@CalculatedPrice,@OriginalCost,@AccessoryCore,
    @OtherDollar,@PrimaryBookValue,@AmountDue,@LicenseFee,@ICompany,@InvenAcct,@Field23,@Field24,@SalesCode,@BaseRetail,@BaseInvAmt,@CommPrice,@Price1,
    @Price2,@StickerPrice,@TotInvAmt,@OptRetail,@OptInvAmt,@OptCost,@Options1,@Category,@Description,@Engine,@ModelType,@FTCode,@Wholesale,@Retail,@Draft,
    @ERRORNUMBER,@ERRORSEVERITY,@ERRORTABLE,@ERRORSTATE,@ERRORPROCEDURE,@ERRORLINE,@errormessage,@FtpDate
    END CATCH
    --==========================================================================
    -- MOVE CURSUR TO NEXT RECORD
    --==========================================================================
    FETCH NEXT FROM Inventory_Cursor
    INTO @FileType ,
    @ACDealerID ,
    @ClientDealerID ,
    @DMSType ,
    @StockNumber ,
    @InventoryDate ,
    @StockType ,
    @DMSStatus ,
    @InvoicePrice ,
    @CostPack ,
    @SalesCost ,
    @HoldbackAmount ,
    @ListPrice ,
    @MSRP ,
    @LotLocation ,
    @TagLine ,
    @Certification ,
    @CertificationNumber ,
    @VehicleVIN ,
    @VehicleYear ,
    @VehicleMake ,
    @VehicleModel ,
    @VehicleModelCode ,
    @VehicleTrim ,
    @VehicleSubTrimLevel ,
    @Classification ,
    @TypeCode ,
    @VehicleMileage ,
    @EngineCylinderCount ,
    @TransmissionType ,
    @VehicleExteriorColor ,
    @VehicleInteriorColor ,
    @CreatedDate ,
    @LastModifiedDate ,
    @ModifiedFlag ,
    @InteriorColorCode ,
    @ExteriorColorCode ,
    @PackageCode ,
    @CodedCost ,
    @Air ,
    @OrderType ,
    @AgeDays ,
    @OutstandingRO ,
    @DlrAccessoryRetail ,
    @DlrAccessoryCost ,
    @DlrAccessoryDesc ,
    @ModelDesc ,
    @Memo1 ,
    @Memo2 ,
    @Weight ,
    @FloorPlan ,
    @Purchaser ,
    @PurchasedFrom ,
    @InternetPrice ,
    @InventoryAcctDollar ,
    @VehicleType ,
    @DealerAccessoryCode ,
    @AllInventoryAcctDollar ,
    @BestPrice ,
    @InStock ,
    @AccountingMake ,
    @GasDiesel ,
    @BookValue ,
    @FactoryAccessoryDescription ,
    @TotalReturn ,
    @TotalCost ,
    @SS ,
    @VehicleBody ,
    @StandardEquipment ,
    @Account ,
    @CalculatedPrice ,
    @OriginalCost ,
    @AccessoryCore ,
    @OtherDollar ,
    @PrimaryBookValue ,
    @AmountDue ,
    @LicenseFee ,
    @ICompany ,
    @InvenAcct ,
    @Field23 ,
    @Field24 ,
    @SalesCode ,
    @BaseRetail ,
    @BaseInvAmt ,
    @CommPrice ,
    @Price1 ,
    @Price2 ,
    @StickerPrice ,
    @TotInvAmt ,
    @OptRetail ,
    @OptInvAmt ,
    @OptCost ,
    @Options1 ,
    @Category ,
    @Description ,
    @Engine ,
    @ModelType ,
    @FTCode ,
    @Wholesale ,
    @Retail ,
    @Draft ,
    @flatfile_createddate,
    @FtpDate;
    END
    CLOSE Inventory_Cursor;
    DEALLOCATE Inventory_Cursor;
    SET ANSI_PADDING OFF
    END
    Arunraj Kumar

    Thank you.
    And another question if the data is already there in the child table if i try to load alone it must delete the old data in the child tablee and need to get load the new data and 
    How to do this ?
    Arunraj Kumar
    You can do that with an IF EXISTS condition
    IF EXISTS (SELECT 1
    FROM YourChildTable c
    INNER JOIn @temptable t
    ON c.Bkey1 = t.Bkey1
    AND c.Bkey2 = t.Bkey2
    DELETE t
    FROM YourChildTable c
    INNER JOIn @temptable t
    ON c.Bkey1 = t.Bkey1
    AND c.Bkey2 = t.Bkey2
    INSERT INTO YourChildTable
    where Bkey1,Bkey2 etc forms the business key of the table
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How do I insert a section with another time signature than the one im inser

    How do I insert a section with another time signature than the one im inser

    Yeah I've been trying to figure this out as well, for example... my song might be 90 bpm and I want to program another track using midi but have it play at 180 bpm. The only way I've found to work around this is to write my 180 bpm part make a sample of this and then loop this into the 90 bpm song.

  • How to show an empty line at the end of a ParagraphView

    Hi everybody,
    I wonder if anyone knows how to extend ParagraphView to show an empty line at the end of every paragraph?
    Thanks in advance,
    mrai

    I tried to use that class and couldn't get it to work.
    JTextField field = new JTextField();
    field.setText("blah blah");
    CompisiteView view = new ParagraphView(field.getDocument().getRootElement());
    int views = view.getViewCount() //always zero...

  • How can i watch purchased tv shows which are stored on the cloud on my laptop?

    how can i watch purchased tv shows which are stored on the cloud on my laptop?

    Hi Miriam1972,
    Thanks for visiting Apple Support Communities.
    You can use iTunes on your laptop to download the tv shows for viewing. See this article for the steps to download the shows:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/HT2519
    Best,
    Jeremy

Maybe you are looking for