Django Pyodbc Stored procedure not all arguments converted during string formatting 1- Sql server

Viewed 822

I am unable to call STORED Procedure from Django. I am able to call use the STORED Procedure from normal python program. Sample working pythoncode

cursor = connect.cursor()
params=('IBM','2016')
cursor.execute("EXEC SP_Competitor_Extract ?, ? ",params)

This piece of code is working fine . But when i am trying to execute from Django it does not working .

def index(request):
    cursor = connection.cursor()
    try:
        params=["IBM", "2015"]
        cursor.execute("{call SP_Competitor_Extract (?,?)}",params)
        while cursor.nextset():
            try:
                results={'results':cursor.fetchall()}
                break
            except pyodbc.ProgrammingError:
                continue

This is giving me the error message not all arguments converted during string formatting

enter image description here

2 Answers
Related