Re: pymssql

2016-09-11 Thread sum abiut
Thanks heaps for your comments, manage to get it work using the as_dict` parameter of the `cursor` object, cus=conn.cursor(as_dict=True) cus.execute("SELECT budget_code,budget_description,rate_type FROM glbud") for row in cus: print(row['budget_code'],row['budget_description'],row['rate_type']

Re: pymssql

2016-09-09 Thread Miki Tebeka
> for row in cus: >print(row.budget_code) > > > NameError: name 'budget_code' is not defined You'll need to use a DictCursor to be able to access rows by name and not position (which IMO is the preferred way). cus = conn.cursor(pymysql.cursors.DictCursor) cus.execute("SELECT * FROM

Re: pymssql

2016-09-08 Thread sum abiut
ok did some changes: conn=pymssql.connect(server,username,password,database) cus=conn.cursor( cus.execute("SELECT budget_code,budget_description,rate_type FROM glbud") for row in cus: print(row) the above code display the selected column but when i iterate and try to print the fields, its

Re: pymssql

2016-09-08 Thread Lawrence D’Oliveiro
On Friday, September 9, 2016 at 12:48:50 PM UTC+12, sum abiut wrote: > cus.execute("SELECT * FROM glbud ") Never use “select *”, except for testing. > for row in cus: >print(row) > this works perfect, but when i try to iterate through and only print out > specific fields i got

Re: pymssql text type

2009-03-12 Thread marc wyburn
On Mar 12, 3:36 pm, a...@pythoncraft.com (Aahz) wrote: > [posted and e-mailed, please reply to group] > > In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, > marcwyburn  wrote: > > >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the > >follwoing error

Re: pymssql text type

2009-03-12 Thread Aahz
[posted and e-mailed, please reply to group] In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, marc wyburn wrote: >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the >follwoing error. > >(, OperationalError("SQL Server >message 102, severity 15, st

Re: pymssql for python 2.6 ?

2008-12-19 Thread M�ta-MCI (MVP)
Hi! Look at http://www.mayukhbose.com/python/ado/ado-connection.php That run OK with Python 2.6 @-salutations -- MCI -- http://mail.python.org/mailman/listinfo/python-list

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Tim Golden
Aspersieman wrote: [... re output params in pymssql / pyodbc ...] Oh, trust me - I've tried a *LOT*. I aggree, submitting a feature request is a good idea. I think I'll do that. :) Looks like someone already has: http://sourceforge.net/tracker/index.php?func=detail&aid=1985956&group_id=162557

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Aspersieman
On Tue, 21 Oct 2008 13:06:37 +0200, Tim Golden <[EMAIL PROTECTED]> wrote: Aspersieman wrote: However, pyODBC doesn't support return variables(parameters) in stored procedures (at least with MS SQL). pymssql is the only db api for python that I've found that can reliably do this. I've tried

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Tim Golden
Aspersieman wrote: However, pyODBC doesn't support return variables(parameters) in stored procedures (at least with MS SQL). pymssql is the only db api for python that I've found that can reliably do this. I've tried adodbapi, pyodbc and one or two others (can't think of the names now... :-/).

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Aspersieman
On Tue, 21 Oct 2008 10:14:56 +0200, ChaosKCW <[EMAIL PROTECTED]> wrote: On Oct 20, 3:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: Eric Wertman wrote: >> I am trying to use pymssql, and have an issue where by the execute >> (not the fetch) is appearing to load all records into memory. >> if I e

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread ChaosKCW
On Oct 20, 3:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > Eric Wertman wrote: > >> I am trying to use pymssql, and have an issue where by the execute > >> (not the fetch) is appearing to load all records into memory. > > >> if I execute > > >> con = pymssql.connect(...) > >> cur = con.cursor() >

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Tim Golden
Eric Wertman wrote: I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of reco

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Eric Wertman
> I am trying to use pymssql, and have an issue where by the execute > (not the fetch) is appearing to load all records into memory. > > if I execute > > con = pymssql.connect(...) > cur = con.cursor() > cur.execute(sql) > rec = cur.fetchone() > > if I put in a query which returns a lot of records

Re: pymssql - insert NULL to int

2007-10-18 Thread Diez B. Roggisch
rc wrote: > On Oct 17, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> rc wrote: >> > How to insert NULL values in to int field using params. >> >> > I'm trying to use pymssql.execute, passing the operation and list of >> > params. One of the values in the params is a NULL value going

Re: pymssql - insert NULL to int

2007-10-17 Thread rc
On Oct 17, 11:07 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > rc wrote: > > How to insert NULL values in to int field using params. > > > I'm trying to use pymssql.execute, passing the operation and list of > > params. One of the values in the params is a NULL value going to int > > field.

Re: pymssql - insert NULL to int

2007-10-17 Thread Diez B. Roggisch
rc wrote: > How to insert NULL values in to int field using params. > > I'm trying to use pymssql.execute, passing the operation and list of > params. One of the values in the params is a NULL value going to int > field. The pymssql._quote() puts ' around the NULL which causes an > exception to

Re: pymssql query

2007-05-16 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Hi, > > I'm trying to use pymssql to execute a stored procedure. Currently, I > have an Excel spreadsheet that uses VBA in this manner: > > Private Function CreateNewParrot(connDb As ADODB.Connection) As Long > Dim objCommand As ADODB.Command > Dim iParrot As Long >

Re: pymssql and date format

2006-02-17 Thread Steve Holden
[EMAIL PROTECTED] wrote: > hi > i am using pymmsql to query a date column in MSSQL database table. > However the result shows for example > (datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be > 2006-02-16 17:50:19.000 > anyway to correct query a date column using pymssql so that it