I have the below 2 commands (insert and drop) in a query. When I run the query I get an error saying:
String or binary data would be truncated.
When I go to check the source table I find out that the table does not exist. It was deleted by the drop statement. I thought the second statement would not be executed because the first one (the insert) failed.
How can I write the below code so that it will fail the entire query and not drop the table unless the first part (the insert) succeeds?
Do I need to use Begin, End and Go?
INSERT INTO SomeTable
SELECT * FROM SomeOtherTable
DROP table SomeOtherTable