#using the pymssql driver
import pymssql

#Connect to your database.
#Replace server name, username, password, and database name with your credentials 
conn = pymssql.connect(server='yourserver.database.windows.net',
	user='yourusername@yourserver', password='yourpassword',
	database='AdventureWorks')
cursor = conn.cursor()

#Execute a simple select statement.
#Replace schema name and table name with your own
cursor.execute('SELECT c.CustomerID, c.CompanyName,COUNT(soh.SalesOrderID) AS OrderCount FROM SalesLT.Customer AS c LEFT OUTER JOIN SalesLT.SalesOrderHeader AS soh ON c.CustomerID = soh.CustomerID GROUP BY c.CustomerID, c.CompanyName ORDER BY OrderCount DESC;')
row = cursor.fetchone()

#Print results from select statement.
while row:
    print str(row[0]) + " " + str(row[1]) + " " + str(row[2])
    row = cursor.fetchone()

#INSERT
#Execute an insert statement
cursor.execute("INSERT SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) OUTPUT INSERTED.ProductID VALUES ('SQL Server Express', 'SQLEXPRESS', 0, 0, CURRENT_TIMESTAMP)")
row = cursor.fetchone()

#Print the ID of the inserted row.
while row:
    print "Inserted Product ID : " +str(row[0])
    row = cursor.fetchone()

@@ -1,10 +1,10 @@
 #
-u
+U
 sing the
@@ -61,16 +61,17 @@
 atabase.
+ 
 %0A#Replac
@@ -94,16 +94,20 @@
 sername,
+ and
  passwor
@@ -111,27 +111,8 @@
 word
-, and database name
  wit
@@ -130,16 +130,64 @@
 entials 
+  %0A#Code is dependent on AdventureWorks database
 %0Aconn = 
@@ -243,18 +243,17 @@
 ws.net',
-%0A%09
+ 
 user='yo
@@ -276,16 +276,18 @@
 erver', 
+%0A%09
 password
@@ -302,18 +302,17 @@
 ssword',
-%0A%09
+ 
 database
@@ -354,16 +354,24 @@
 rsor()%0A%0A
+#SELECT%0A
 #Execute
@@ -401,317 +401,88 @@
 ent.
-%0A#Replace schema name and table name with your own%0Acursor.execute('SELECT c.CustomerID, c.CompanyName,COUNT(soh.SalesOrderID) AS OrderCount FROM SalesLT.Customer AS c LEFT OUTER JOIN SalesLT.SalesOrderHeader AS soh ON c.CustomerID = soh.CustomerID GROUP BY c.CustomerID, c.CompanyName ORDER BY OrderCount DESC
+ %0Acursor.execute('SELECT TOP 10 Title, FirstName, LastName from SalesLT.Customer
 ;')%0A
@@ -616,16 +616,19 @@
 (row%5B2%5D)
+   
 %0A    row
@@ -656,16 +656,20 @@
 %0A#INSERT
+    
 %0A#Execut
@@ -689,16 +689,20 @@
 tatement
+    
 %0Acursor.
@@ -754,16 +754,23 @@
 tNumber,
+ Color,
  Standar
@@ -841,46 +841,35 @@
 S ('
-SQL Server Express', 'SQLEXPRESS
+Bike', 'B1', 'Blue
 ', 
+5
 0, 
+12
 0, C
@@ -947,16 +947,17 @@
 ted row.
+ 
 %0Awhile r

Update sample_python_win.py