SQL Server Error Msg 148 – Incorrect time syntax in time string ‘%.*ls’ used with WAITFOR

In this blog post, let’s learn about the error message “148 – Incorrect time syntax in time string ‘%.*ls’ used with WAITFOR.” in Microsoft SQL Server, the reason why it appears and the solution to fix it.

SQL Server Error Message

148 – Incorrect time syntax in time string ‘%.*ls’ used with WAITFOR.

Reason for the Error

Here’s an example that results in the SQL Server error Msg 148:

WAITFOR DELAY '00:00:60'

The query above attempts to introduce a 60-second delay using the WAITFOR statement. The time syntax used in the WAITFOR statement, on the other hand, is erroneous. The time string ’00:00:60′ denotes 60 seconds, while the maximum value for seconds is 59. As a result, SQL Server generates error Msg 148.

SQL Server Error Msg 148 - Incorrect time syntax in time string ‘%.*ls’ used with WAITFOR

Solution

To rectify this problem, we must use the proper time syntax in the WAITFOR expression. The time string in the WAITFOR statement should be in the format ‘hh:mi:ss,’ where hh represents hours, mi minutes, and ss seconds. Here’s a modified query using the proper time syntax:

WAITFOR DELAY '00:01:00'

In the above query, we utilised the proper time syntax to impose a delay of 1 minute or 60 seconds. This query will produce the desired result without error.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this blog post, let’s learn about the error message “1459 – An error occurred while accessing the database mirroring...
In this blog post, let’s learn about the error message “7937 – Columnstore index has one or more missing column...