Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Include-objects - order varies on different sql servers #282

Open
vansree opened this issue Aug 8, 2023 · 0 comments
Open

Include-objects - order varies on different sql servers #282

vansree opened this issue Aug 8, 2023 · 0 comments

Comments

@vansree
Copy link

vansree commented Aug 8, 2023

Hi,

I am using and tying to get selected tables and views and stored procedures. The code works fine.

When I execute for multiple servers, each server order of objects is different. I was expecting the order is same - either the order I provided (or) by type and name (or) by name. It is not doing that. Wondering if this is the default behavior? If not, please fix it!

$Servers = "Server1\InstanceD", "Server2\InstanceQ", "Server3\InstanceU", "Server4\InstanceP"
$db = "MySQLDB"
$db_objects = "Schema.Table1", "dbo.StoredProcedure1",
"Schema.View1", "Schema.Table2",
"Schema.View2"
foreach($Server in $Servers) {
$Server2 = $Server.Replace("", "_")
$WriteToPath = "C:\User\Scripts Generated$($Server2) $($db) - objects.sql"
mssql-scripter -S $Server -d $db --exclude-headers --include-objects $db_objects -f $WriteToPath
}

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant