简体   繁体   中英

Adventure Works Cannot Bulk load Error

Can someone please help me?

I am using SQL Server 2012 Express the 64 bit version and I am trying to create the Adventure Works database that I downloaded from the MS site.

I got it to create the database but when it gets to populating the tables I get the following message:

Msg 4861, Level 16, State 1, Line 4 Cannot bulk load because the file "C:\\Desktop\\AdventureWorks 2012 OLTP Script\\AdventureWorks 2012 OLTP Script\\Address.csv" could not be opened. Operating system error code 3(The system cannot find the path specified.).

Below are the comments it came with and the paths that I set.

/*
 * In order to run this script manually, either set the environment variables,
 * or uncomment the setvar statements and provide the necessary values if
 * the defaults are not correct for your installation.
 */

:setvar SqlSamplesDatabasePath   "C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\"

-- NOTE: Change this path if you copied the script source to another path

:setvar SqlSamplesSourceDataPath "C:\Desktop\AdventureWorks 2012 OLTP Script\AdventureWorks 2012 OLTP Script\"

I was able to figure it out and install it successfully. I simply added the full path which included the users folder and my user folder followed by the rest of the path on the SqlSampleSourceDataPath variable.

Thank you all for your posts!

1) Locate your SQl server installed folder by referring below mappings

80 = SQL Server 2000    >>  8.00
90 = SQL Server 2005    >>  9.00
100 = SQL Server 2008    >> 10.00
105 = SQL Server 2008R2 >> 10.50
110 = SQL Server 2012    >> 11.00
120 = SQL Server 2014    >> 12.00
130 = SQL Server 2016    >> 13.00
140 = SQL Server 2017    >> 14.00
150 = SQL Server 2019    >> 15.00

for your SQL Server 2012 it will be 110

2) Go to SSMS query tab and click on SQLCMD mode

3) You have to set Paths in provided query like below, please note below paths are of my machine with SQl server 2017 Your SqlSamplesDatabasePath will be different based upon mapping provided above

Your SqlSamplesSourceDataPath will be the path of extracted zip file of AdventureWorks 2008R2 Data Warehouse those you have downloaded.

:setvar SqlSamplesDatabasePath   "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\"

:setvar SqlSamplesSourceDataPath "C:\Users\rakeshk4\Downloads\AdventureWorks 2008R2 Data Warehouse\"

4) Run the script instawdwdb.sql in SQLCMD mode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM