This is a way where you can copy data to your AzureSQLDB ( provided you've already implemented the schema ) using Powershell
Write-Datatable can be found here https://gallery.technet.microsoft.com/scriptcenter/2fdeaf8d-b164-411c-9483-99413d6053ae
$Q = $('Select * from [{0}].[{1}];' -f $tb.Schema, $tb.Name )
Write-Verbose $('{0} - Reading data from [{1}].[{2}] ;' -f (get-date -Format 'yyyy-MM-dd HH:mm:ss') , $tb.Schema, $tb.Name ) ;
$Result = $db.ExecuteWithResults( $q )
$TsCopy = Get-Date
Write-DataTable -ServerInstance $TargetSQLServerName -Username $TargetUserName -Password $TargetPwd -Database $TargetDbName -TableName $tb.Name -Schema $tb.Schema -Data $Result.tables[0] -BatchSize 1000 ;
$TsCopyEnd = Get-Date
$nSec = (New-TimeSpan -Start $TsCopy -End $TsCopyEnd).TotalSeconds ;
Write-output $('{0} - Table [{1}].[{2}] exported to [{3}].[{4}] - {5} rows - Time needed {6}' -f (get-date -Format 'yyyy-MM-dd HH:mm:ss'), $tb.Schema, $tb.Name , $tb.Schema, $tb.Name, $Result.tables[0].Rows.Count, (get-date (( Get-Date -day 1 –month 1 -year 1900 -Hour 0 -Minute 0 -Second 0 ).addseconds( $nSec )) -format 'HH:mm:ss.fff') ) ;
Primitive, but it does the job.
TEST IT - TEST IT - TEST IT
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me