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()
4
  • 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. Commented Mar 8, 2020 at 12:05
  • cursor = conn1.cursor() PBI_SP = """EXEC proc_CreateProblemTicket @CurrentDate=str(date.today())""" conn1.commit() cursor.execute(PBI_SP) cursor.commit() Commented Mar 8, 2020 at 12:07
  • Not in the comments, edit your question. Commented Mar 8, 2020 at 12:20
  • Does this answer your question? Python - pyodbc call stored procedure with parameter name Commented Mar 8, 2020 at 19:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.