偶尔对比起2016以下的版本(比如ssms2014),ssms2016有一个小地方有区别。就是报错的行号有区别

This tutorial shows you how to query data from a
MySQL database in Python by using MySQL Connector/Python API such
as fetchone() , fetchmany()澳门微尼斯人手机版, , and fetchall() .

CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci

举个例子,下面同样的语句在ssms2014和ssms2016里面运行。就是如下的效果

To query data in a MySQL database from Python, you need to do the
following steps:

 

 1 CREATE PROCEDURE T111
 2 AS 
 3 SELECT GETDATE()
 4 GO
 5 
 6 
 7 CREATE PROCEDURE T112
 8 AS 
 9 SELECT GETDATE() AS 
10 GO
11 
12 
13 
14 
15 DECLARE @xml = '
16 <Root>
17     <Nr></Nr>
18     <T>
19 </Root>
20 '
  1. Connect to the MySQL
    Database,
    you get a MySQLConnection object.
  2. Instantiate a  MySQLCursor object from the
    the MySQLConnection object.
  3. Use the cursor to execute a query by calling
    its  execute() method.
  4. Use fetchone() ,  fetchmany() or  fetchall() method to fetch
    data from the result set.
  5. Close the cursor as well as the database connection by calling
    the  close() method of the corresponding object.

显而易见,这里的行9和 xml
变量的定义都是有问题的。所以ssms2014里面直接给出 

We will show you how to use fetchone() , fetchmany() ,
and  fetchall() methods in more detail in the following sections.

发表评论

电子邮件地址不会被公开。 必填项已用*标注