New-AzureSqlJobContent
Creates content that can be run or applied across entities within a job target.
Syntax
New-AzureSqlJobContent
-ContentName <String>
-CommandText <String[]>
[[-AzureSqlJobConnection] <AzureSqlJobConnection>]
[<CommonParameters>]
New-AzureSqlJobContent
-ContentName <String>
-DacpacUri <Uri>
[[-AzureSqlJobConnection] <AzureSqlJobConnection>]
[<CommonParameters>]
Description
The New-AzureSqlJobContent cmdlet creates content that can be run or applied across entities within a job target. Content can be created in the form of T-SQL scripts or DACPAC URIs.
Examples
Example 1: Create a T-SQL script to be used for execution
PS C:\>New-AzureSqlJobContent -ContentName "CreateMyTestTable" -CommandText "IF NOT EXISTS (SELECT name FROM SYS.TABLES WHERE name = 'MyTestTable') BEGIN CREATE TABLE MyTestTable(X INT PRIMARY KEY IDENTITY, Y INT) END"
ContentName ContentType
----------- -----------
CreateMyTestTable Script
This command creates a T-SQL script to be used for execution within a job.
Example 2: Import a T-SQL script from a file to be used for execution
PS C:\>New-AzureSqlJobContent -ContentName "MyScript" -CommandText (Get-Content .\MyScript.sql)
ContentName ContentType
----------- -----------
MyScript Script
This command imports a T-SQL script from a file to be used for execution within a job.
Example 3: Create DACPAC content to be used for execution within a job
PS C:\>New-AzureSqlJobContent -ContentName "MyDacpac" -DacpacUri "http://mystorageaccount.blob.core.windows.net/myContainer/mydacpac.dacpac?sv=2014-02-14&sr=c&sig=7q%2FpZvcD2ivMgiqZ2qwNF6GBI8XLPmAz3%2B4hfbtQf4k%3D&st=2015-06-12T07%3A00%3A00Z&se=2099-06-20T07%3A00%3A00Z&sp=r"
ContentName ContentType
----------- -----------
MyDacpac Dacpac
This command creates DACPAC content to be used for execution within a job. The provided URI should be publically accessible to allow the system to successfully apply the DACPAC across the job target.
Parameters
-AzureSqlJobConnection
Specifies the connection state object for the job. You can get the connection state object through the New-AzureSqlJobConnection cmdlet. If you do not specify this parameter, the connection state is used from a prior call to the Use-AzureSqlJobConnection cmdlet.
Type: | AzureSqlJobConnection |
Position: | 1 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-CommandText
Specifies the command text of a T-SQL script. The script can contain GO statements. When containing GO statements, the system splits the command text into multiple batches.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ContentName
Specifies the name of the content.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DacpacUri
Specifies the URI for a DACPAC to be used for application. The URI must be accessible by the system.
Type: | Uri |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |