Invoke-SqlCmd QueryTimeout - by AtulSharma

Status : 

  External<br /><br />
		This item may be valid but belongs to an external system out of the direct control of this product team.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 523996 Comments
Status Closed Workarounds
Type Bug Repros 6
Opened 1/8/2010 2:25:34 PM
Access Restriction Public


Help says:
-QueryTimeout <Int32>
    Specifies the number of seconds before the queries time out. If a timeout value is not specified, the queries do not time out. The timeout must be an integer between 1 and 65535.

A simpler repro scenario for QueryTimeout.

PS C:\Users\atushar> Invoke-Sqlcmd -Query "waitfor delay '00:00:31'" -Database master -ServerInstance localhost
Invoke-Sqlcmd : Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
At line:1 char:14
+ Invoke-Sqlcmd <<<<  -Query "waitfor delay '00:00:31'" -Database master -ServerInstance localhost
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
    + FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand

Also few more defects that are found by John from PS team. Thanks John.

It does accept a value 0 and does nothing and still defaults to 30 seconds.  In addition, it doesn’t limit the max time to 65K ~18 hours but accepts int::maxvalue which is effectively no time out(i.e. ~24k days).

Sign in to post a comment.
Posted by AtulSharma on 3/1/2010 at 12:52 PM
Please mention the correct channel at least. I don't know who owns the code of Powershell with SQL.
Posted by Microsoft on 3/1/2010 at 12:36 PM
Please open the bug through correct channels. Thanks.