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
{{ message }}
Repository navigation
Commit 5b062cd
Browse filesBrowse the repository at this point in the historyBrowse files
$readerQuery="SELECT 'dbatoolsci_csvreader_marker' AS id FROM sys.all_objects AS a CROSS JOIN sys.all_objects AS b"
407
+
$readerRequestQuery="SELECT r.session_id FROM sys.dm_exec_requests AS r CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) AS t WHERE t.text LIKE '%dbatoolsci_csvreader_marker%' AND r.session_id <> @@SPID"
408
+
try {
409
+
$splatLockedExport=@{
410
+
SqlInstance=$callerServer
411
+
Database="master"
412
+
Query=$readerQuery
413
+
Path=$lockedPath
414
+
WarningAction="SilentlyContinue"
415
+
}
416
+
$lockedResult=Export-DbaCsv@splatLockedExport
417
+
$lockedWarning=$WarnVar
418
+
} finally {
419
+
$lockedFile.Dispose()
420
+
}
421
+
}
422
+
423
+
AfterAll {
424
+
# A request left behind by the old code would keep running until its session is gone.
0 commit comments