'Is there any way to store output of "sp_help 'table name';" when we execute it from python [duplicate]


import pyodbc 
connection_string = ("DRIVER={##########};"
                     "SERVER=############;"
                     "DATEBASE=#############"
                     "UID=############;"
                     "PWD=#########"
                     )

cnxn = pyodbc.connect(connection_string)
cursor = cnxn.cursor()
query = "sp_help '<tablename>';"
cursor.execute(query)
result1= cursor.fetchone()
print (result1)
cnxn.close()

When I execute the above from python I get this as output:

('XX_SAMPLE', 'dbo', 'user table', datetime.datetime(2022, 2, 15, 10, 43, 57, 610000))

but when I execute the same query from the SSMS I get :

enter image description here


so, is there any way to store rest all data that is displayed in SSMS if I run it from python



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source