If you are trying to put a pool, over a slab, and are attempting to do so by building a sandbox over it ....
Where did this slab come from? Is is stable? Has it cracked yet? How thick is it? Is it reinforced.
A concrete slab may seem solid until you put a multi-ton bag of water on it and it shifts and cracks.
However, if you deem your slab to be up to the task, you are going to have to build something to hold that sand in place. You could form and pour a curb (pinned to the existing slab, so get out your concrete drill) or you could also build a wooden curb. You are not looking at anything like 8" deep of sand. A 4x4 would be enough, if it accommodates your slope, but that slope may get you (see below). If going with a wood curb, I would use pressure treated, with a bead of something (silastic, roofing cement, liquid nails, whatever) under it to prevent sand from migrating under it, and then galvanized right angle brackets with outdoor construction screws into the wood and a ramset to hold them into the concrete.
As Kimkats said, the sand will have to be level, so if your slab is sloped, which it will be if it was built as a patio, then your overall curb height has to be enough to take into account this slope. For example, I have a concrete slab, covered by cement paver block (don't ask me how that has not shifted, and become a mess, I didn't put it in and it is a mystery to me). I took out a section of the block and filled in with pea gravel for my hot tub, kind of what you want to do with your sand idea. On my 7'6" square hot tub, one end is on the bare concrete, and then other end has pea gravel up to the top of the block.
If your pool is 24' long and you have a 1/4" per foot of slope (which is normal) running in that direction, you sand is going to be 6" higher on one end than on the other. Your curb will have to be more than an 4x4 in that case.