0

I have an MsSQL stored procedure which is getting executed by the command :

EXEC proc_CreateProblemTicket @CurrentDate='2020-03-08'.

Now I have a python django application where I need to call the stored proc and pass the dynamic date. In the above example, the date is hard coded but I would like this is to dynamic. Everyday when the stored proc gets executed, it should have current day.

cursor = conn1.cursor()
PBI_SP = """EXEC proc_CreateProblemTicket @CurrentDate=str(date.today())""" 
conn1.commit()
cursor.execute(PBI_SP)
cursor.commit()
James Z
  • 12,209
  • 10
  • 24
  • 44
  • What have you tried so far, why didn't it work? Please do show the users here your Python code that you used, and explain why it wasn't working as you expect. Thanks. – Thom A Mar 08 '20 at 12:05
  • cursor = conn1.cursor() PBI_SP = """EXEC proc_CreateProblemTicket @CurrentDate=str(date.today())""" conn1.commit() cursor.execute(PBI_SP) cursor.commit() – Subrajit Gupta Mar 08 '20 at 12:07
  • Not in the comments, [edit] your question. – Thom A Mar 08 '20 at 12:20
  • Does this answer your question? [Python - pyodbc call stored procedure with parameter name](https://stackoverflow.com/questions/30964608/python-pyodbc-call-stored-procedure-with-parameter-name) – Ivan Starostin Mar 08 '20 at 19:30

0 Answers0