SQLCMD

  • Hi ,
      When i am trying to execute SQLCDM getting following error.
    Sqlcmd: '-i': Missing argument. Enter '-?' for help.
    Following is the script
    Write-Output("`r`n*** Executing CreateHmsDb.sql ***`r`n")

    sqlcmd `
      -U $hmsSysAdminUser `
        -P $hmsSysAdminPassword `
        -S $hmsServer `
      -d master `
        -i $PSScriptRoot/mssql/new/HMS/CreateHmsDb.sql `
        -v hmsDbName=$hmsDbName `
        -v hmsDataName=$hmsDataName `
        -v hmsDataFQFileName=$hmsDataFQFileName `
        -v hmsDataSize=$hmsDataSize `
        -v hmsDataMaxSize=$hmsDataMaxSize `
        -v hmsDataGrowth=$hmsDataGrowth `
        -v hmsFileGroupName=$hmsFileGroupName `
        -v hmsFileGroupFQFileName=$hmsFileGroupFQFileName `
        -v hmsFileGroupSize=$hmsFileGroupSize `
        -v hmsFileGroupMaxSize=$hmsFileGroupMaxSize `
        -v hmsFileGroupGrowth=$hmsFileGroupGrowth `
        -v hmsLogName=$hmsLogName `
        -v hmsLogFQFileName=$hmsLogFQFileName `
        -v hmsLogSize=$hmsLogSize `
        -v hmsLogMaxSize=$hmsLogMaxSize `
      -v hmsLogGrowth=$hmsLogGrowth `

    Thanks,
    Padmakumar

  • Is it because of your attempt to concatenate the $PSScriptRoot variable with the rest of the file path?  Perhaps you need to enclose the file path part in quotes, and maybe you have a to use an ampersand or plus sign as a concatenation operator.  And don't file paths use backslashes, not forward slashes?

    John

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply