CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
SQL Server Invalid parameter 1 specified for datediff, Microsoft OLE DB Provider for SQL Server error '80040e14'
- Article ID:
130 - Date Created
Saturday, April 2, 2011 - Last Updated
Wednesday, June 20, 2012 - This Article Has been Viewed
3877 times - Short Desc
When using a datediff within your SQL Queries, you have to make sure that the parameters that you are using are correctly written and used. - Details
When you have to use the DateDiff within your SQL Queries (Select Statements), make sure that you use the parameters correctly, if not you will receive the following error within the SQL Server Management Studio.Msg 1023, Level 15, State 1, Line 1
Invalid parameter 1 specified for datediff.
Within ASP you will receive the following Error:Microsoft OLE DB Provider for SQL Server error '80040e14'
Invalid parameter 1 specified for datediff.
/StatComs.asp, line 14 - Recreate Issue
To recreate this issue.<%
sql.commandtext="select datediff('s', MyDate, getdate()) as date from table"
%>
The above will give you the error due to the single quotes around the s - Resolve Issue
To resolve this issue.<%
sql.commandtext="select datediff(s, MyDate, getdate()) as date from table"
%>
As you can see in the above statement, we have removed the single Quotes from the s from the statement.
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19545
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16826