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 |
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-22 : 03:07:05
|
Hey all,If we use operator < <= > >= to compare NON nummeric, then how it is being compared..? what it returns? eg : .... WHERE someObj1.UniqueX <= someObj2.UniqueX considering :- someObj1.UniqueX someObj2.UniqueX MM1 NN1 MM2 NN2 MM3 NN3 ~~~Focus on problem, not solution~~~ |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-22 : 03:12:05
|
it goes by ascii order.'B' is greater than 'A' etc KH |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-22 : 03:31:30
|
oh really? thanks.. but i still couldnt figure out this (with the red font) -->adopted from my cut n paste code :-SELECT det.ItemStorageID, det.OriginQty AS AVAQtyFROM tblItemDetail AS detLEFT JOIN #Data AS dat ON dat.FaceValue=det.OriginQtyWHERE dat.MaxItems >= (SELECT COUNT(*) FROM tblItemDetail AS x WHERE x.OriginQty=det.OriginQtyAND x.ItemStorageID >= det.ItemStorageID) it seems has big impact coz when i remove, the result query becomes nothing ~~~Focus on problem, not solution~~~ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-22 : 03:50:11
|
can you post a subset of the records from tblItemDetails and #Data ? KH |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-22 : 03:57:14
|
here,from #datamaxItems FaceValue2 24from tblItemdetailItemStorageID OriginQtyIS06A00248 24.0IS06A00671 24.0 ~~~Focus on problem, not solution~~~ |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-22 : 04:02:26
|
and also...any difference between CREATE TABLE #Data anddeclare @Data table ????~~~Focus on problem, not solution~~~ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-22 : 04:46:16
|
quote: Originally posted by maya_zakry and also...any difference between CREATE TABLE #Data anddeclare @Data table ????~~~Focus on problem, not solution~~~
Yes. #Data is temporary table@Data is table variableboth are not permanent table. They only exists within the context or scope of your stored procedure.One major different is for temp table you can insert the result of a stored procedure to itlike insert into #temp( . . .) exec your_stored_procedurebut you can't do this with table variable KH |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-03-22 : 20:57:35
|
| thanks.. khtan! that 's a good simple explaination.~~~Focus on problem, not solution~~~ |
 |
|
|
|
|
|
|
|