Skip to content

Interoperability: QuoteName | Get-Path #6

Description

@petervandivier

Objects that get a quoted name from the DB may pass the quoted name onto downstream references. Regex -replace "[\[\]]" use may be required for successful parsing

$objs = (
    "object.with.[Quote Name Required]",
    "object.with.[Quote Name Required 2]"
) | ForEach-Object {
    $d = $_.Split(".")[0]
    $s = $_.Split(".")[1]
    $o = $_.Split(".")[2]

    Get-SqlObject -server "localhost" -database $d -schema $s -object $o
}

$objs | ForEach-Object {
    $fp = Get-SqlObjFilePath `
        -project default `
        -Database $_.database `
        -schema $_.schema `
        -name ($_.name -replace "[\[\]]")`
        -type $_.base_type 
    
    $fp.fullPath
    Test-Path $fp.fullPath
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions