I am using Test-DbaNetworkLatency
from dbatools
(https://docs.dbatools.io/#Test-DbaNetworkLatency) to check the network latency between my application server and SQL server instance.
But Test-DbaNetworkLatency
command line query doesn't support query string more than 128 characters. I have a big query statement to test. How can I load a query from saved sql file?
Asked
Active
Viewed 126 times
0

Joey Yi Zhao
- 37,514
- 71
- 268
- 523
-
Have you tried reading the T-SQL script file into a variable and passing the variable as parameter in your script to the cmdlet? e.g. `$query = [System.IO.File]::ReadAllText("C:\Scripts\YourBigScript.sql")` – Dan Guzman Oct 07 '19 at 11:16
-
1Out of curiosity, what query are you trying to send? The purpose of this cmdlet is to establish a SQL connection and run a *simple* query (emphasis mine). – Ben Thul Oct 07 '19 at 17:49
-
@DanGuzman yes it works. Thanks – Joey Yi Zhao Oct 07 '19 at 22:51