-1

i'm trying to execute this type of sql command with python but that doesn't work

import pymssql

_conn = pymssql.connect(** SQL parameter)
_cur = _conn.cursor()
_cur.execute("EXEC(SELECT * something)")

i got this error.

enter image description here Thanks.

1 Answers1

0

The EXECUTE command takes a string, not plain SQL commands:

EXEC('SELECT * something')

But I'm not sure why you're doing this, you could just pass the SELECT statement directly.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895