I had a very bad experience with Temazepam. If you have depression do not drink alcohol if you are taking this drug. Or at least be very careful. It can increase impulsiveness issues as well.
My doctor prescribed me Trazadone for insomnia issues. It worked really well. It is actually an old anti-depressant but works better for sleep issues (Since you have to take about 600 mgs to treat depression - and you'd be asleep before it works!)