我需要从Python执行存储过程。我正在使用pyodbc来做到这一点。存储过程需要传递datetime参数。
我使用以下代码:
cursor.execute('exec [Data].[GetData]?',datetime.datetime.now())
我收到以下错误:
ProgrammingError:('42000','[42000] [Microsoft] [ODBC SQL Server驱动程序] [SQL Server]不允许从数据类型datetime到bigint的隐式转换。使用CONVERT函数运行此查询。(257)(SQLExecDirectW )“)
我该怎么办 ?
from datetime import datetime
cursor.execute('exec [Data].[GetData]?',datetime.now())
有相同的错误检查您的导入