Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
CactusJuice
Starting Member
46 Posts |
Posted - 2003-02-13 : 17:41:01
|
I have a column AdPrice which is type smallmoney. When I do a select using a BETWEEN the high end filters out but not the low end. --Test ValuesSET @Min = 1000SET @Max = 5000SELECT AdPrice ... WHERE AdPrice BETWEEN @Min AND @MaxUsing the above test values I don't get any ads back that are over $5000. Great. But I do get back everything below $1000. I have tried passing the values from the web page as smallmoney and as int. I've also tried CAST to int from within the sproc. I've even tried using >= AND <=.This is freaking me out. What am I missing?thanks,Cameron |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-02-13 : 17:46:27
|
| I suspect there is something wrong with your code somewhere.Likely you are setting @min to 0try thiscreate table #a(i smallmoney)insert #a select 5insert #a select 50insert #a select 500insert #a select 1000insert #a select 1500insert #a select 5000insert #a select 50000declare @min smallmoney, @max smallmoneyselect @min = 1000, @max = 5000select * from #a where i between @min and @maxdrop table #a==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
CactusJuice
Starting Member
46 Posts |
Posted - 2003-02-13 : 18:50:37
|
quote: I suspect there is something wrong with your code somewhere.
OK thanks. I ran your example and it worked fine so obviously I've got something hosed in my overall code. At least I know I am using BETWEEN correctly! Just need to find my error.cheers,Cameron -- (eop) |
 |
|
|
|
|
|