create a table in ssms with python

Solutions on MaxInterview for create a table in ssms with python by the best coders in the world

showing results for - "create a table in ssms with python"
Edouard
03 Sep 2017
1import pyodbc 
2conn = pyodbc.connect('Driver={SQL Server};'
3                      'Server=RON\SQLEXPRESS;'
4                      'Database=TestDB;'
5                      'Trusted_Connection=yes;')
6
7cursor = conn.cursor()
8
9cursor.execute('''
10
11               CREATE TABLE People
12               (
13               Name nvarchar(50),
14               Age int,
15               City nvarchar(50)
16               )
17
18               ''')
19
20conn.commit()
21