I need to query a database for some information and then store it into a .csv file in case the dispatch system goes down. I'm running into some issues with the select
query as well as the output
statement. Here is what I have:
SELECT cmpy, veh, driver, attendant, trainee, unit_code, startdate
FROM vehicle_schedule
WHERE startdate >= 2015-07-22
ORDER BY cmpy, veh
The error that I am getting is this:
Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value '2010-05-25' to data type int.
I'm not sure what is going on and exactly how to fix the issue. Also I can't get it to output to a file, I get the error: incorrect syntax near 'OUTPUT'
Any help would be amazing!