Editar

Partilhar via


Export-AzSynapseSqlScript

Exports a sql script from a Synapse workspace.

Syntax

Export-AzSynapseSqlScript
      -WorkspaceName <String>
      -OutputFolder <String>
      [-Name <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]
Export-AzSynapseSqlScript
      -WorkspaceObject <PSSynapseWorkspace>
      -OutputFolder <String>
      [-Name <String>]
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]
Export-AzSynapseSqlScript
      -InputObject <PSSqlScriptResource>
      -OutputFolder <String>
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]

Description

The Export-AzSynapseSqlScript cmdlet exports an Azure Synapse sql script to a SQL Server query(.sql) file. If you specify the name of a sql script, the cmdlet exports the specified sql script. If you do not specify a name, the cmdlet export all sql scripts in the workspace.

Examples

Example 1

Export-AzSynapseSqlScript -WorkspaceName ContosoWorkspace -OutputFolder "C:\sqlscript"

Exports all sql scripts in the workspace ContosoWorkspace to the folder "C:\sqlscript".

Example 2

Export-AzSynapseSqlScript -WorkspaceName ContosoWorkspace -OutputFolder "C:\sqlscript" -Name "ContosoSqlScript"

Exports a single sql script named ContosoSqlScript in the workspace ContosoWorkspace to the folder "C:\sqlscript".

Example 3

$ws = Get-AzSynapseWorkspace -Name ContosoWorkspace
$ws | Export-AzSynapseSqlScript -Name ContosoSqlScript -OutputFolder "C:\sqlscript"

Exports a single sql script called ContosoSqlScript in the workspace ContosoWorkspace to the folder "C:\sqlscript" through pipeline.

Example 4

$sqlscript = Get-AzSynapseSqlScript  -WorkspaceName ContosoWorkspace -Name ContosoSqlScript
$sqlscript | Export-AzSynapseSqlScript -OutputFolder "C:\sqlscript"

Exports a single sql script called ContosoSqlScript in the workspace ContosoWorkspace to the folder "C:\sqlscript" through pipeline.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

The sql script object.

Type:PSSqlScriptResource
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The sql script name.

Type:String
Aliases:SqlScriptName
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OutputFolder

The folder where the sql scripts should be placed.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WorkspaceName

Name of Synapse workspace.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WorkspaceObject

workspace input object, usually passed through the pipeline.

Type:PSSynapseWorkspace
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

PSSynapseWorkspace

PSSqlScriptResource

Outputs

String