Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb8a5fe

Browse files
author
Randy Costner
committed
Adds export so copy-database is the only visible option
1 parent 8cc7761 commit eb8a5fe

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

‎Powershell/CopyDatabase.psm1

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@
55
.Description
66
Copies schema, structure (tables, views, etc.), to an empty SQL Server databaase. Also supports copying data via bcp.
77
8-
.Parameter ServerName
9-
Database to copy from
10-
.Parameter DestinationServer
8+
.Parameter ServerName
9+
Database to copy from
10+
.Parameter DestinationServer
1111
Database to copy to
12-
.Parameter SourceUser
12+
.Parameter SourceUser
1313
Database User for the source database
14-
.Parameter SourcePassword -
14+
.Parameter SourcePassword -
1515
Password for the source database
1616
.Parameter DestinationUser
1717
Database User for the destination database
18-
.Parameter DestinationPassword
18+
.Parameter DestinationPassword
1919
Password for the destination database
2020
.Parameter SourceDatabase
2121
Name of the databse to copy too
22-
.Parameter DestinationDB
22+
.Parameter DestinationDB
2323
Name of the destination database
24-
.Parameter CopyData
24+
.Parameter CopyData
2525
Flag to trigger bulk copy of data to destination database
26-
.Parameter fileName
26+
.Parameter fileName
2727
Path to the Schema.sql file included in this repo ".\ExtractDB\Schema.sql"
28-
.Parameter tempPath
28+
.Parameter tempPath
2929
A temp directory on a drive with enough free space to save the bcp files during the export and import operations ".\BCP\"
30-
.Parameter logPath
30+
.Parameter logPath
3131
Directory to write error logs too ".\log\"
3232
3333
3434
#>
3535

3636
function copy-database{
3737
param(
38-
$ServerName,
38+
$ServerName,
3939
$DestinationServer,
4040
$SourceUser,
4141
$SourcePassword,
4242
$DestinationUser,
4343
$DestinationPassword,
44-
$SourceDatabase,
44+
$SourceDatabase,
4545
$DestinationDB ,
4646
$CopyData,
4747
$fileName = "..\ExtractDB\Schema.sql",
@@ -77,6 +77,7 @@ function copy-database{
7777
}
7878
}
7979
}
80+
Export-ModuleMember -Function copy-database
8081

8182
function copy-schema {
8283
param(
@@ -91,14 +92,14 @@ function copy-schema {
9192
{
9293
$error | Out-File -FilePath "$($ErrorFile)"
9394
$sql.SqlStatement | Out-File -Append -FilePath "$($ErrorFile)"
94-
95+
9596
$error.Clear()
9697
}
9798
Write-Output $Sql
9899
}
99100

100101
#TODO: Breakup into extract and import
101-
function copy-data{
102+
function copy-data{
102103
param(
103104
[string] $SchemaName,
104105
[string] $TableName,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /