jiaoz / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

First 4 Characters Truncated for String or varchar data by pyodbc #341

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.import pyodbc
cn = pyodbc.connect(r'DRIVER={SQL Server Native Client 11.0};Server=servername 
or IP,1433;DATABASE=SomeDatabase;UID=web;PWD=4Data2Publish;')
cursor = cn.cursor()
cursor.execute(r'select MyColumn from MyTable')
rows = cursor.fetchall()
for row in rows:
    print row.MyColumn

cursor.close()
cn.close()

2. This should give me a print of all My Column values. 
3. My Column is varchar(100) in database (sql server 2008)

What is the expected output? What do you see instead?
Expected:
Himanshu

Observe
cted

What version of the product are you using? On what operating system?
Python 2.4.3
SQL Server Native Client 11.0
GCC 4.1.2 20080704 (Red Hat 4.1.2-50)

Please provide any additional information below.
First 4 characters are not printed by above code.

sqlcmd works fine but pyodbc fails
sqlcmd
'Microsoft (R) SQL Server Command Line Tool
Version 11.0.1790.0 Linux

Original issue reported on code.google.com by Pahwa.Hi...@gmail.com on 10 Oct 2013 at 1:03