Historical tick range

I’m trying to back-test a stock. I do not know the start and end date range the database covers.
For instance, symbol SPY does not go back 5 years from current date. You get an exception (start time is too soon). Also, if I specify a closing time after the last tick, you get an exception (end time tis too late). The exception is OK. But a calling method that returns both the starting and ending datetime range of the stock covered by the database would be very helpful.