Friday, May 15, 2026

SQL 2025 master class LAB 16 bcp

BCP [AdventureWorks2025].[Sales].[SalesOrderDetail] out C:\backup\SODetail_Out.txt -S windows -T -c -u -t]
 
USE [AdventureWorks2025]
GO
CREATE TABLE [dbo].[TestBCP](
[SalesOrderID] [int] NOT NULL,
[SalesOrderDetailID] [int] IDENTITY(1,1) NOT NULL,
[CarrierTrackingNumber] [nvarchar](25) NULL,
[OrderQty] [smallint] NOT NULL,
[ProductID] [int] NOT NULL,
[SpecialOfferID] [int] NOT NULL,
[UnitPrice] [money] NOT NULL,
[UnitPriceDiscount] [money] NOT NULL,
[LineTotal] [numeric](38, 6) NOT NULL,
[rowguid] [uniqueidentifier] NOT NULL,
[ModifiedDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
 

BCP [AdventureWorks2025].[dbo].[testBCP] in C:\backup\SODetail_Out.txt -S windows -T -c -u -t]

--with thanks and acknowledgement to https://www.sqlshack.com/bcp-bulk-copy-program-command-in-action/

 --housekeeping 

DROP TABLE dbo.TestBCP 
--delete  
C:\backup\SODetail_Out.txt