Thursday, January 6, 2011

iBatis "select top" statement

I use MS SQL server to select a list of products, for example,

select top 200 from mydb(nolock)

If I like to use a parameter to replace 200 in iBatis, I first tried

select top #value# from mydb(nolock)

but it didn't work. After googling and found the correct way is
to use the $value$ to pass the parameter, i.e.,

select top $value$ from mydb(nolock)

0 comments:

Post a Comment