17 September 2019

BCP Command



There are various methods available for bulk data operations.
  1. BCP utility
  2. BULK INSERT
  3. Using OPENROWSET
  4. Import/Export wizard
The BCP (Bulk Copy Program) utility is a command line that program that bulk-copies data between a SQL instance and a data file using a special format file. The BCP utility can be used to import large numbers of rows into SQL Server or export SQL Server data into files. The BCP data files don’t include any schema details or format information

BCP  DatabaseName.SchemaName.[TableName | ViewName] | Query
     [IN datafile | OUT datafile | queryout datafile | format] 
     [Options]


First enble CMDSHELL
Use Master
GO

EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
GO

EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE WITH OVERRIDE
GO
EXEC master..xp_cmdshell 'BCP [AdventureWorks2012].[Person].[Address] OUT c:\Person.xls -T -c'



Resource Governor

Resource Governor  is a feature that you can use to manage SQL Server workload and system resource consumption. Resource Governor enables y...