[web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Dan
Cool, How can i forgot the executesql!
thank you very much!!!

On Jan 18, 4:19 pm, Bruno Rocha  wrote:
> So you can use:
>
> results = msdb.execute_sql("SELECT * FROM table.")
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


Re: [web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Bruno Rocha
So you can use:

results = msdb.execute_sql("SELECT * FROM table.")


-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: MSSQL How to access tables which not created by web2py

2012-01-18 Thread Dan
Thanks a lot, Bruno.

That really helps, but since my legacy DBs are too much and too
complex (MSSQL Server are only readable to me), I decide to create my
own connections and queries to my MSSQL Server.
Thanks again.

On Jan 18, 3:57 pm, Bruno Rocha  wrote:
> You need to map the existent table and set migrate=False, also you will
> need to specify which field is the 'id' or primary keys, and for all fields
> you need to tell the datatype.
>
> msdb.define_table(
>                             'test',
>                             FIeld('cod', 'id'),
>                             Field('field1', "datatype"),
>                             Field('field2', "datatype"),
>                             migrate=False
>                            )
>
> look 
> here:http://web2py.com/books/default/chapter/29/6#Legacy-databases-and-key...
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]