I am transferring some data from other databases, so I use raw SQL queries to insert data into the database. But I don't know how to get the last inserted id from raw sql queries in django. I tried this
affected_count1=cursor2.execute("table')") and SELECT IDENT_CURRENT('MyTable')
but it gives me the error "(1305, 'FUNCTION pydev.SCOPE_IDENTITY does not exist')"
So please tell me how can I get the last inserted id in raw sql queries in django
source share