|
Extracting contents of two tables using BCP and a view The easiest way of doing this is to create a view over the two tables and then bcp the content of the view out in your required format. e.g. if you have customer details in a customer table and an address table and you want to extract the contents of the combined table in a tab delimited file create view vw_Customer_Address as select cust.CustomerId, cust.CustomerForename, cust.CustomerSurname, cust.Telephone, addr.HouseNo, addr.Street, addr.Town, addr.county, Addr.postcode From tblCustomer cust Join tblAddress addr ON Cust.AddressId = addr.AddressId Then just bcp this table out BCP mydb.dbo.vw_Customer_address out cust.dat -S(local) -T -c
|