I have written a set of sql files that make my entire database schema. I
have divided the schema into seperate files mostly for "manageability"
(for example, I can check error codes as I go along, and terminate the
process as soon as an error occurs).
I have several tsql files in a directory, and I want to be able to write
a batch script (or something similar), which allows me to:
1). Process each of the individual files (i.e. execute the commands in
the file)
2). report succes or failure for the file
3). Abort the entire process if a command in one of the files failed
The batch part I can largely figure out myself. So my question basically
can be simplified as:
How can I read and execute TSQL commands from a file - AND return an
success/error code ?