{"id":27300,"date":"2023-07-26T06:05:00","date_gmt":"2023-07-26T04:05:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=27300"},"modified":"2023-10-04T21:12:20","modified_gmt":"2023-10-04T19:12:20","slug":"use-bulk-insert-in-sql-server","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/","title":{"rendered":"How To Use BULK INSERT In SQL Server?"},"content":{"rendered":"\n<p>The BULK INSERT command in T-SQL (Transact-SQL) is a powerful feature for importing data from flat files into SQL Server tables. It&#8217;s essential for database administrators and developers who are often required to populate tables in an optimized manner. This article will guide you through the different aspects of using BULK INSERT with practical examples.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#introduction-to-the-sql-server-bulk-insert-statement\" >Introduction to the SQL Server Bulk Insert statement<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#bulk-insert-generic-syntax\" >Bulk Insert generic syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#bulk-insert-practical-example-in-t-sql\" >Bulk Insert practical example in T-SQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#use-xml-format-files-for-better-flexibility\" >Use XML format files for better flexibility<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#bulk-insert-format-file-example\" >Bulk Insert format file example<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#bulk-insert-common-options\" >Bulk Insert common options<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#sql-server-bulk-insert-best-practices\" >SQL Server Bulk Insert best practices<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-introduction-to-the-sql-server-bulk-insert-statement\"><span class=\"ez-toc-section\" id=\"introduction-to-the-sql-server-bulk-insert-statement\"><\/span>Introduction to the SQL Server Bulk Insert statement<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>BULK INSERT is a T-SQL command that allows for the bulk import of data from flat files into SQL Server tables. It&#8217;s especially useful for quickly inserting large sets of data. This feature is a highly efficient <strong>T-SQL command designed specifically to import large volumes of data into SQL Server tables from flat files<\/strong>, such as CSV or TXT formats. Unlike traditional methods of data import that handle one record at a time, BULK INSERT processes data in batches, thereby significantly speeding up the overall import process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bulk-insert-generic-syntax\"><span class=\"ez-toc-section\" id=\"bulk-insert-generic-syntax\"><\/span>Bulk Insert generic syntax<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To get you started, let&#8217;s delve into the basic syntax and a simple example. This first example is a generic one and simply explains the basic syntax and arguments.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">BULK INSERT target_table  \nFROM 'data_file'  \nWITH (  \n&lt;bulk_insert_option> [, ...]  \n)\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bulk-insert-practical-example-in-t-sql\"><span class=\"ez-toc-section\" id=\"bulk-insert-practical-example-in-t-sql\"><\/span>Bulk Insert practical example in T-SQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here&#8217;s a T-SQL code example demonstrating how to quickly bulk insert data into a table named <em>dbo.Products_Staging<\/em>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- BULK INSERT to load a flat txt or CSV file into a database\nBULK INSERT dbo.Products_Staging\nFROM 'C:\\FlatFile.txt'\nWITH (\n   FIELDTERMINATOR = ',', \n   ROWTERMINATOR = '\\n', \n   FIRSTROW = 2\n);\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-use-xml-format-files-for-better-flexibility\"><span class=\"ez-toc-section\" id=\"use-xml-format-files-for-better-flexibility\"><\/span>Use XML format files for better flexibility<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If your source data file follows a specific format, you may need to define that format for the <strong><em>BULK INSERT<\/em><\/strong> operation to proceed smoothly. The two most common ways to do this are by using a Format File or by specifying the terminators for rows and fields directly in the command. You can define a format file to specify the layout of your source <a href=\"https:\/\/expert-only.com\/en\/ssis\/import-csv-file-into-sql-server-with-ssis\/\">data file<\/a>. The format file can be XML-based or non-XML-based. Use the <strong><em>FORMATFILE<\/em><\/strong> argument with the location to an XML format file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Using a Format File \nBULK INSERT dbo.Products_Staging\nFROM 'C:\\FlatFile.txt'  \nWITH (  \n  FORMATFILE='C:\\FormatFile.xml'\n);\n<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bulk-insert-format-file-example\"><span class=\"ez-toc-section\" id=\"bulk-insert-format-file-example\"><\/span>Bulk Insert format file example<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Certainly, creating a format file is crucial for customizing how <code>BULK INSERT<\/code> will interact with your data file. The format file instructs SQL Server how to interpret the flat file&#8217;s structure. Below is an example of what a <code>FormatFile.xml<\/code> might look like when configuring it for a CSV file that matches a hypothetical <code>Products<\/code> table with three columns: <code>ProductID<\/code>, <code>ProductName<\/code>, and <code>Price<\/code>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;BCPFORMAT xmlns=\"http:\/\/schemas.microsoft.com\/sqlserver\/2004\/bulkload\/format\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\">\n &lt;RECORD>\n  &lt;FIELD ID=\"1\" xsi:type=\"CharTerm\" TERMINATOR=\",\" MAX_LENGTH=\"10\"\/>\n  &lt;FIELD ID=\"2\" xsi:type=\"CharTerm\" TERMINATOR=\",\" MAX_LENGTH=\"50\"\/>\n  &lt;FIELD ID=\"3\" xsi:type=\"CharTerm\" TERMINATOR=\"\\r\\n\" MAX_LENGTH=\"20\"\/>\n &lt;\/RECORD>\n &lt;ROW>\n  &lt;COLUMN SOURCE=\"1\" NAME=\"ProductID\" xsi:type=\"SQLINT\"\/>\n  &lt;COLUMN SOURCE=\"2\" NAME=\"ProductName\" xsi:type=\"SQLNVARCHAR\"\/>\n  &lt;COLUMN SOURCE=\"3\" NAME=\"Price\" xsi:type=\"SQLFLOAT\"\/>\n &lt;\/ROW>\n&lt;\/BCPFORMAT>\n<\/pre>\n\n\n\n<p>Sure, let&#8217;s break it down in simpler terms:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <strong><em>RECORD<\/em><\/strong> tag is like a rule book for each line in your text file. It tells SQL Server what to expect when it looks at a single line in your file.<\/li>\n\n\n\n<li>The <strong><em>FIELD<\/em><\/strong> one is a smaller part of that gives more details. It says what marks the end of each piece of information in a line (like a comma between two words) and how long each piece can be.<\/li>\n\n\n\n<li>The <strong><em>ROW<\/em><\/strong> tag however connects the pieces of information in your text file to specific places in your SQL table.<\/li>\n\n\n\n<li>Then the <strong><em>COLUMN<\/em><\/strong> XML tag represents a smaller part of that gives more specifics. It tells SQL Server what kind of data it&#8217;s looking at (like numbers or words) and where to put it in the table.<\/li>\n<\/ul>\n\n\n\n<p>So, RECORD and FIELD are about understanding the text file, while ROW and COLUMN are about loading that information into the target SQL Server table. By using a format file like this, you provide a blueprint to SQL Server for understanding how to read your flat file and populate the target table. This method is particularly useful when your flat file&#8217;s structure doesn&#8217;t perfectly align with your SQL table&#8217;s schema or when you&#8217;re working with complex data types.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bulk-insert-common-options\"><span class=\"ez-toc-section\" id=\"bulk-insert-common-options\"><\/span>Bulk Insert common options<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are four of the most commonly used options you can specify with BULK INSERT.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><em>FIELDTERMINATOR<\/em><\/strong>: Specifies the field delimiter.<\/li>\n\n\n\n<li><strong><em>ROWTERMINATOR<\/em><\/strong>: Specifies the row delimiter.<\/li>\n\n\n\n<li><strong><em>FIRSTROW<\/em><\/strong>: Specifies the starting row for data import, i.e. skip or any existing header.<\/li>\n\n\n\n<li><strong><em>ERRORFILE<\/em><\/strong>: Specifies the file to log any errors.<\/li>\n<\/ol>\n\n\n\n<p>For instance, the <code>ERRORFILE<\/code> option can be used as follows:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Logging errors to a log file\nBULK INSERT dbo.Products_Staging\nFROM 'C:\\FlatFile.txt'\nWITH (\n   FIELDTERMINATOR = ',', \n   ROWTERMINATOR = '\\n',\n   ERRORFILE = 'C:\\error.log'\n);\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-sql-server-bulk-insert-best-practices\"><span class=\"ez-toc-section\" id=\"sql-server-bulk-insert-best-practices\"><\/span>SQL Server Bulk Insert best practices <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To make the most out of the BULK INSERT feature with smooth T-SQL execution, follow these three recommandations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure your source file and target table schema match.<\/li>\n\n\n\n<li>Use batch sizes judiciously for performance tuning.<\/li>\n\n\n\n<li>Always backup your target table before performing bulk insert operations.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-the-bulk-insert-command\">Conclusion on the Bulk Insert command<\/h3>\n\n\n\n<p>BULK INSERT in T-SQL is a handy tool for database administrators and developers who need to populate tables swiftly and efficiently. By understanding the syntax and options available, you can leverage its full potential for various data import tasks. You can always go deeper and read the official <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/statements\/bulk-insert-transact-sql?view=sql-server-ver16\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">documentation<\/a> about the feature. The Bulk insert is also available in SSIS, also with specific options. Loading large files in a <a href=\"https:\/\/www.skydevelopers.net\/blog\/2-ways-to-import-large-sql-files-to-mysql-database\/\" target=\"_blank\" rel=\"noreferrer noopener\">challenge<\/a> in all SQL database types. <\/p>\n\n\n\n<p><strong><em>Of course, feel free to leave your questions and thoughts in the comments section below, we&#8217;d be glad to answer.<\/em><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>The BULK INSERT command in T-SQL (Transact-SQL) is a powerful feature for importing data from flat files into SQL Server tables. It&#8217;s essential for database administrators and developers who are often required to populate tables in an optimized manner. <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\" title=\"How To Use BULK INSERT In SQL Server?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10819,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-27300","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Use BULK INSERT In SQL Server? T-SQL<\/title>\n<meta name=\"description\" content=\"Learn how to use BULK INSERT in SQL Server for efficient data import, use format files and common options to optimize T-SQL queries.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Use BULK INSERT In SQL Server?\" \/>\n<meta property=\"og:description\" content=\"Learn how to use BULK INSERT in SQL Server for efficient data import, use format files and common options to optimize T-SQL queries.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-26T04:05:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-04T19:12:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How To Use BULK INSERT In SQL Server?\",\"datePublished\":\"2023-07-26T04:05:00+00:00\",\"dateModified\":\"2023-10-04T19:12:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\"},\"wordCount\":807,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\",\"name\":\"How To Use BULK INSERT In SQL Server? T-SQL\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg\",\"datePublished\":\"2023-07-26T04:05:00+00:00\",\"dateModified\":\"2023-10-04T19:12:20+00:00\",\"description\":\"Learn how to use BULK INSERT in SQL Server for efficient data import, use format files and common options to optimize T-SQL queries.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Use BULK INSERT In SQL Server?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Use BULK INSERT In SQL Server? T-SQL","description":"Learn how to use BULK INSERT in SQL Server for efficient data import, use format files and common options to optimize T-SQL queries.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"How To Use BULK INSERT In SQL Server?","og_description":"Learn how to use BULK INSERT in SQL Server for efficient data import, use format files and common options to optimize T-SQL queries.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-07-26T04:05:00+00:00","article_modified_time":"2023-10-04T19:12:20+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How To Use BULK INSERT In SQL Server?","datePublished":"2023-07-26T04:05:00+00:00","dateModified":"2023-10-04T19:12:20+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/"},"wordCount":807,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/","url":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/","name":"How To Use BULK INSERT In SQL Server? T-SQL","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg","datePublished":"2023-07-26T04:05:00+00:00","dateModified":"2023-10-04T19:12:20+00:00","description":"Learn how to use BULK INSERT in SQL Server for efficient data import, use format files and common options to optimize T-SQL queries.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/planning-4897792_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/use-bulk-insert-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How To Use BULK INSERT In SQL Server?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=27300"}],"version-history":[{"count":23,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27300\/revisions"}],"predecessor-version":[{"id":27327,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/27300\/revisions\/27327"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10819"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=27300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=27300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=27300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}