You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/Invoke-DbaQuery.ps1
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,10 @@ function Invoke-DbaQuery {
80
80
Enables syntax and semantic validation without executing the actual statements. The SQL engine parses and compiles queries but doesn't run them.
81
81
Use this to validate T-SQL syntax, check object references, and verify permissions before running potentially destructive scripts in production environments.
82
82
83
+
.PARAMETERQuotedIdentifier
84
+
Prepends SET QUOTED_IDENTIFIER ON to each batch before execution. This is required for INSERT, UPDATE, and DELETE operations on tables with filtered indexes, indexed views, computed columns, or XML indexes.
85
+
Use this when modifying tables with filtered indexes and experiencing silent failures, as SMO connections may have QUOTED_IDENTIFIER set to OFF depending on server/database configuration.
86
+
83
87
.PARAMETERAppendConnectionString
84
88
Adds custom connection string parameters for specialized connection requirements like MultiSubnetFailover, encryption settings, or timeout values.
85
89
Use this for Availability Group connections, Always Encrypted scenarios, or when you need connection properties not available through standard parameters. Authentication must still be handled via SqlInstance and SqlCredential.
@@ -184,6 +188,11 @@ function Invoke-DbaQuery {
184
188
185
189
Leverages your own parameters, giving you full power, mimicking Connect-DbaInstance's `-MultiSubnetFailover -ConnectTimeout 60`, to adhere to official guidelines to target FCI or AG listeners.
186
190
See https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/sqlclient-support-for-high-availability-disaster-recovery#connecting-with-multisubnetfailover
Executes an INSERT statement with QUOTED_IDENTIFIER set to ON. This is required when modifying tables that have filtered indexes, as SQL Server requires this setting for such operations.
Compare-Object-ReferenceObject $expectedParameters-DifferenceObject $hasParameters| Should -BeNullOrEmpty
@@ -358,6 +359,30 @@ SELECT 2
358
359
{ Invoke-DbaQuery-SqlInstance $TestConfig.instance2-Database tempdb -Query "SELEC p FROM c"-NoExec -EnableException } | Should -Throw "Incorrect syntax near 'SELEC'."
359
360
}
360
361
362
+
It "supports QuotedIdentifier for filtered index compatibility" {
363
+
# Create table with filtered index that requires QUOTED_IDENTIFIER ON
0 commit comments