• andycadley (6/3/2014)


    Useful, but I'd avoid using the args[] variable and do it "the Powershell way" with a Param block at the start of the script, that way you get things like autocomplete for free and named arguments, as well as getting guarantees that mandatory parameters have to be supplied.

    param(

    [Parameter(Mandatory=$true, HelpMessage='Enter name of server')]

    [String]$ServerName,

    [Parameter(Mandatory=$true, HelpMessage='Enter the name of the database')]

    [String]$Database,

    [Parameter(Mandatory=$true, HelpMessage='Enter the path to the source file')]

    [String]$Sourcefile

    )

    I'm thinking that would make the process batch-job resistant.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)