[web2py] Re: MSSQL Select statements

2010-11-13 Thread Brian M
I use web2py and MS SQL with raw SQL queries often. results = db.executesql("SELECT foo,bar FROM my_table WHERE blah = ? and something = ?" , ('criteria 1', 'criteria 2'), True) The two extra pieces at the end will let you safely bind in query parameters and the final True arg makes it so that th

[web2py] Re: MSSQL Select statements

2010-11-13 Thread mdipierro
yes On Nov 13, 3:10 pm, Crim wrote: > Nice i like the idea of raw sql statements ... but when i execute a > select statement would it return anything ex > > variable = db.executesql("select") > > would that work? (would test when i get home but im at work right now) > > On Nov 13, 2:41 pm, md

[web2py] Re: MSSQL Select statements

2010-11-13 Thread Crim
Nice i like the idea of raw sql statements ... but when i execute a select statement would it return anything ex variable = db.executesql("select") would that work? (would test when i get home but im at work right now) On Nov 13, 2:41 pm, mdipierro wrote: > web2py DAL only sees tables that

[web2py] Re: MSSQL Select statements

2010-11-13 Thread DenesL
Hi Crim, if you can use db.user.email that means you have defined the table in web2py. As I understand it, as per your previous posts, that table was not created with web2py so it must be a legacy table. You can access it depending on two things: 1) If the table has an auto incrementing field sim

[web2py] Re: MSSQL Select statements

2010-11-13 Thread mdipierro
web2py DAL only sees tables that are defined via the DAL. For raw sql you can do db.executesql("") On Nov 13, 2:39 pm, Crim wrote: > thanks for the in-depth reply ^ ^ > > im using existing tables and i master and another one stuff setup to > do the same thing but this is a school project so i

[web2py] Re: MSSQL Select statements

2010-11-13 Thread Crim
thanks for the in-depth reply ^ ^ im using existing tables and i master and another one stuff setup to do the same thing but this is a school project so im not to picky at the moment xD but thanks for the info for future use. Can i do the db(db.user.email == s).select() if i dont instantiate it

[web2py] Re: MSSQL Select statements

2010-11-13 Thread Niphlod
uhm are you using existing tables or you are using web2py to create them ?? dbo shouldn't affect at all the query, but a few hints nonetheless : master is a really nasty place to create tables "master" db should be left untouched in web2py you define a database when you istantiate

[web2py] Re: MSSQL Select statements

2010-11-13 Thread Crim
im not using web2py to do the second select statement the one "FROM [master].[dbo].[User]" just the: if db(db.User.Email == s).select(): print "success" i connected to my db and want to select the table user and the column email On Nov 13, 1:05 pm, mdipierro wrote: > There is no webpy API

[web2py] Re: MSSQL Select statements

2010-11-13 Thread mdipierro
There is no webpy API to generate "FROM [master].[dbo].[User]" only "FROM [User]" On Nov 13, 12:45 pm, Crim wrote: > what cant i use? the web2py statement? > > On Nov 13, 12:26 pm, mdipierro wrote: > > > You cannot this in web2py. perhaps you can create a database view. > > > On Nov 13, 12:11

[web2py] Re: MSSQL Select statements

2010-11-13 Thread Crim
what cant i use? the web2py statement? On Nov 13, 12:26 pm, mdipierro wrote: > You cannot this in web2py. perhaps you can create a database view. > > On Nov 13, 12:11 pm, Crim wrote: > > > > > > > > > alright so i got a connection between my MSSql server any web2py. that > > has been all sorted

[web2py] Re: MSSQL Select statements

2010-11-13 Thread mdipierro
You cannot this in web2py. perhaps you can create a database view. On Nov 13, 12:11 pm, Crim wrote: > alright so i got a connection between my MSSql server any web2py. that > has been all sorted out but now im having issues with how to select a > tuple from web2py > > in web2py i have this code:

<    1   2