insert NULL value in sybase database using python
04:26 03 Jan 2014

Let's say we have the following sql statement:

INSERT INTO myTable VALUES (1,"test")

In my python code the first value is either an integer or NULL. How can I insert NULL value using python code?

Code snippet:

    var1 = getFirstValue()
    var2 = getSecondValue()
    qry = "INSERT INTO myTable VALUES (%d,%s)" % (var1,var2)

Whenever var1 is None it is throwing error, but I want NULL to be inserted.

python sql django null