parameters - sqlalchemy execute sql with TOP parametrized -


i want use limit in mssql, top, parametrized. hoped can top parametrized that:

engine.execute( text("select top :t * orders), t=100)   

but get: statement(s) not prepared. (8180) (sqlexecdirectw)') 'select top ? * orders' (100,)

with top fixed or out works fine.

any ideas?

as indicated in answer, assuming using @ least sql server 2005, should able run:

engine.execute(text('select top (:t) * orders'), t=100) 

sql server should accept parameter long it's enclosed in parentheses.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -