From f91e54bd25fafa097ab6206d985b109eab4e6beb Mon Sep 17 00:00:00 2001 From: o9o9 Date: Fri, 13 Oct 2017 22:24:01 +0900 Subject: [PATCH] Update RunSQL_SQL_Walkthrough.ps1 Fixed an issue that did not work as expected when using Windows authentication. This file is used by In-database R Analytics(https://docs.microsoft.com/en-us/sql/advanced-analytics/tutorials/sqldev-download-the-sample-data). --- Misc/RSQL/RunSQL_SQL_Walkthrough.ps1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Misc/RSQL/RunSQL_SQL_Walkthrough.ps1 b/Misc/RSQL/RunSQL_SQL_Walkthrough.ps1 index 4ccea46d..24dc8e19 100644 --- a/Misc/RSQL/RunSQL_SQL_Walkthrough.ps1 +++ b/Misc/RSQL/RunSQL_SQL_Walkthrough.ps1 @@ -235,7 +235,16 @@ $db_tb = $dbname + ".dbo.nyctaxi_sample" Write-host "start loading the data to SQL Server table..." -Foregroundcolor "Yellow" try { - bcp $db_tb in $csvfilepath -t ',' -S $server -f taxiimportfmt.xml -F 2 -C "RAW" -b 200000 -U $u -P $p + #The MS SQL Server user and password is specified + if($u -and $p) + { + bcp $db_tb in $csvfilepath -t ',' -S $server -f taxiimportfmt.xml -F 2 -C "RAW" -b 200000 -U $u -P $p + } + #The MS SQL Server user and password is not specified - using the Windows user credentials + else + { + bcp $db_tb in $csvfilepath -t ',' -S $server -f taxiimportfmt.xml -F 2 -C "RAW" -b 200000 -T + } } catch {