- SQL Server csv in xml out Project
- SQL Server csv in xml out Project Part 2
- SQL Server csv in xml out Project Part 3
- SQL Server csv in xml out Project Part 4
- SQL Server csv in xml out Project Part 5
- SQL Server csv in xml out Project Part 6
- SQL Server csv in xml out Project Part 7
- SQL Server csv in xml out Project Part 8
- SQL Server csv in xml out Project Part 9
- SQL Server csv in xml out Project Part 10
- SQL Server csv in xml out Project Part 11
- SQL Server csv in xml out Project Part 12
- SQL Server Move Data to a File Part 13
Part 8
usp_15NoDuplicateOrders
-- We need to ensure that by adding this order to the three tables we do not -- produce and duplicates in the tables. What constitutes a duplicate? -- We are relying on the primary keys to raise their own errors, -- but can we do some checking of our own? DECLARE @RowCount INT; DECLARE @ErrMsg VARCHAR(200) SET @RowCount = 0; SELECT OrderNumber FROM dbo.OrdersHistory WHERE OrderNumber IN (SELECT OrderNumber FROM [dbo].[01HeaderBulkInsert]); SET @RowCount = @@ROWCOUNT; IF @RowCount > 0 BEGIN SET @ErrMsg = 'Error. Duplicate. This order has already been processed.'; RAISERROR(@ErrMsg, 16,1); END