Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

connect to ssms with python

import pyodbc 
conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=server_name;'
                      'Database=database_name;'
                      'Trusted_Connection=yes;')

cursor = conn.cursor()
cursor.execute('SELECT * FROM database_name.table')

for row in cursor:
    print(row)
Source by datatofish.com #
 
PREVIOUS NEXT
Tagged: #connect #ssms #python
ADD COMMENT
Topic
Name
9+4 =