473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Re: Problems Writing =?UTF-8?B?wqMgKHBvdW5kIHN0ZXJsaW5nKSBUbyBNUw==?==?UTF-8?B?IFNRTCBTZXJ2ZXIgdXNpbmcgcHltc3NxbA==?=

Darren Mansell wrote:
Hi.

I'm relatively new to python so please be gentle :)

I'm trying to write a £ symbol to an MS SQL server using pymsssql . This
works but when selecting the data back (e.g. using SQL management
studio) the £ symbol is replaced with £ (latin capital letter A with
circumflex).

This is a bit of a non-answer but... use pyodbc[*],
use NVARCHAR cols, and use unicode values on insert:

<code>
import pyodbc
import unicodedata

db = pyodbc.connect (r"Driver={SQL Server};Server=SVR17;Database=TDI;TrustedConnectio n=Yes")

db.execute ("CREATE TABLE b (x NVARCHAR (1))")
db.execute ("INSERT INTO b (x) VALUES (?)", ['£'])
db.execute ("INSERT INTO b (x) VALUES (?)", [u'£'])
db.execute ("COMMIT")

for x, in db.execute ("SELECT x FROM b"):
print repr (x), unicodedata.name (x[0])

</code>

[*] Don't know if it's strictly necessary, but I gave up
on pymssql a while back when it had issues with unicode and
was using the ntwdblib which is more-and-more unsupported.

TJG
Nov 17 '08 #1
0 1285

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Jim Hubbard | last post by:
Are you up to speed on the difficulties in using the 1.1 .Net framework? Not if you are unaware of the 1,596 issues listed at KBAlertz (http://www.kbalertz.com/technology_3.aspx). If you are...
1
by: mary | last post by:
I am developing an Access db which will be used by multiple users. My questions are: Does MS Access have problems with multiple users accessing the db at once? If yes, what is your solution...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
1
by: Travis Stewart | last post by:
Hi, I've been working on some software to control an older GPIB card for the past couple of weeks. I have function prototypes in a header file pc-mate2.h and the functions are defined in...
4
by: HNguyen | last post by:
Hi, I have a Web application in ASP.NET. My Application allows the users upload files into the server after checking their user names and passwords. For each transaction, the Web program will...
1
by: chauc3r | last post by:
I'm having problems writing to a text file. Basically it refuses to write anything. The file is created. At the appropiate times it goes into the correct if statements (I have verified this...
2
by: patrickdepinguin | last post by:
Hi, I use zlib to write data structures to a compressed file, using the gzwrite function. Afterwards I read the data back with gzread. I notice that this works well when the data written is not...
24
by: tanmay | last post by:
please tell me how to get the following output using loops... 1) * * * * * * * * * * * * * * * *
12
by: xamdam | last post by:
Hi fellas, I am experiencing problems reading a 2GB zipfile consisting of multiple zipped files. I found a thread http://mail.python.org/pipermail/python-dev/2005-April/053027.html that mentions...
0
by: Rob P | last post by:
Is there a reliable way of doing this? It seems that I am having problems with the data files being used by 'other' processes, despite them being custom to the application I'm writing. I'm sure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.