Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SQL PowerShell Examples #1787

Merged
merged 9 commits into from
Mar 13, 2019
Merged

Conversation

SQLvariant
Copy link
Contributor

@SQLvariant SQLvariant commented Mar 12, 2019

Added examples specific to the official SqlServer PowerShell module, to help customers get started.

PR Summary

Added examples specific to the official SqlServer PowerShell module, to the README_FOR_MARKETPLACE.md file.

PR Checklist

Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets.
Please mark anything not applicable to this PR NA.

  • PR has a meaningful title
  • Summarized changes
  • PR has tests
  • This PR is ready to merge and is not work in progress
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready

Added examples specific to the official SqlServer PowerShell module, to help customers get started.
@msftclas
Copy link

msftclas commented Mar 12, 2019

CLA assistant check
All CLA requirements met.

## SQL PowerShell Examples
In order to use these examples (below), you need to install the SqlServer module from the [PowerShell Gallery](https://www.powershellgallery.com/packages/SqlServer).

<pre><code>Install-Module -Name SqlServer -AllowPrerelease</code></pre>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we are recommending a prerelease version of this module rather than the last stable version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, great catch. I pulled that in from my recent post. The latest Prerelease includes Invoke-Sqlcmd working on PSCore. Since Azure Data Studio is cross-platform, having the x-plat Invoke-Sqlcmd is very useful and relevant to those customers. We can either pull the " -AllowPrerelease" portion now, or we can wait until the final version of the module ships, and pull it then.

Although, ironically, if PSCore still hasn't shipped then the customer would have to download that preview as well. (We could include a link to the post on the PowerShell blog as well, to help the x-plat customers)

In my mind, there is literally no other SQL PowerShell cmdlet as important as Invoke-Sqlcmd. I can't ever see broadly suggesting customers use a -AllowPrerelease version after this one ships.

I'm fine with leaving " -AllowPrerelease" until the ned of the month, or pulling it now. Up to you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with -AllowPrerelease but please add a comment as to why we're installing the prerelease one.

@SydneyhSmith
Copy link
Collaborator

This looks great to me overall, thanks for the contribution!

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 12, 2019

@SQLvariant can you switch your <pre><code>'s to the markdown way?

```powershell
code goes here
```

and for the output ones, use:

```
output goes here
```

ServerA 13.0.5233 SP2 CU4
ServerB 14.0.3045 RTM CU12</code></pre>

In this example, we will do a 'dir' (alias for Get-ChildItem) to get the list of all SQL Server instances listed in your Registered Servers file, and then use the Get-SqlDatabase cmdlet to get a list of Databases for each of those instances.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single backticks for inline markdown formatting.

Suggested change
In this example, we will do a 'dir' (alias for Get-ChildItem) to get the list of all SQL Server instances listed in your Registered Servers file, and then use the Get-SqlDatabase cmdlet to get a list of Databases for each of those instances.
In this example, we will do a `dir` (alias for `Get-ChildItem`) to get the list of all SQL Server instances listed in your Registered Servers file, and then use the `Get-SqlDatabase` cmdlet to get a list of Databases for each of those instances.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. I can take care of that right now.

WideWorldImporters Normal 3.2 GB 2.6 GB Simple 130 sa
</code></pre>

This example uses the Get-SqlDatabase cmdlet to retireve a list of all databases on the ServerB instance, then presents a grid/table to select which databases should be backed up. Once the user clicks on the "OK" button, only the highlighted databases will be backed up.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This example uses the Get-SqlDatabase cmdlet to retireve a list of all databases on the ServerB instance, then presents a grid/table to select which databases should be backed up. Once the user clicks on the "OK" button, only the highlighted databases will be backed up.
This example uses the `Get-SqlDatabase` cmdlet to retrieve a list of all databases on the ServerB instance, then presents a grid/table (using the `Out-GridView` cmdlet) to select which databases should be backed up. Once the user clicks on the "OK" button, only the highlighted databases will be backed up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Out-GridView -PassThru |
Backup-SqlDatabase -CompressionOption On</code></pre>

This example again gets list of all SQL Server instances listed in your Registered Servers file, then reports every failed SQL Agent Job since Midnight, for each SQL Server instances listed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This example again gets list of all SQL Server instances listed in your Registered Servers file, then reports every failed SQL Agent Job since Midnight, for each SQL Server instances listed.
This example, again, gets list of all SQL Server instances listed in your Registered Servers file, then reports every failed SQL Agent Job since Midnight, for each SQL Server instances listed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 12, 2019

Can you move this newly added section after the ## Example Scripts section? Then give your heading a 3rd # (so ### SQL PowerShell Examples) so it becomes a subsection of ## Example Scripts

Updated the format of the code examples.
Moved location of SQL PowerShell Examples to be after Example Scripts.
@SQLvariant
Copy link
Contributor Author

Can you move this newly added section after the ## Example Scripts section?

Done.

Fixed typo in description.
Commas.
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just some minor nitpicks.

docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
docs/azure_data_studio/README_FOR_MARKETPLACE.md Outdated Show resolved Hide resolved
TylerLeonhardt and others added 4 commits March 13, 2019 12:19
Co-Authored-By: SQLvariant <SQLvariant@live.com>
Co-Authored-By: SQLvariant <SQLvariant@live.com>
Co-Authored-By: SQLvariant <SQLvariant@live.com>
Co-Authored-By: SQLvariant <SQLvariant@live.com>
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TylerLeonhardt TylerLeonhardt merged commit 910bd62 into PowerShell:master Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants