Skip to content

DOC-1510: edit tsql additions #66

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

Merged
merged 1 commit into from
Feb 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,21 @@ sqlserver::login{'WIN-D95P1A3V103\localAccount':
}
```

###To run custom TSQL statements
###To run custom TSQL statements:

To use `sqlserver_tsql` to trigger other classes or defined types:

To use `sqlserver_tsql` as a trigger to other defined types in order to trigger other workflows
```
sqlserver_tsql{ 'Query Logging DB Status':
instance => 'MSSQLSERVER',
onlyif => "IF (SELECT count(*) FROM myDb.dbo.logging_table WHERE
message like 'FATAL%') > 1000 THROW 50000, 'Fatal Exceptions in Logging', 10",
notify => Exec['To Many Fatal Errors']
}
notify => Exec['Too Many Fatal Errors']
}
```

It can also be used to help clean up regular logs with conditional checks
To clean up regular logs with conditional checks:

```
sqlserver_tsql{ 'Cleanup Old Logs':
instance => 'MSSQLSERVER',
Expand All @@ -117,7 +119,8 @@ sqlserver_tsql{ 'Cleanup Old Logs':
}
```

In the event you want something to always execute you can also leave the `onlyif` parameter out and have it execute every time
If you want something to always execute, you can leave out the `onlyif` parameter:

```
sqlserver_tsql{ 'Always running':
instance => 'MSSQLSERVER',
Expand Down Expand Up @@ -170,9 +173,9 @@ Terminology differs somewhat between various database systems; please refer to t
* `sql_sysadmin_accounts`: The Windows or SQL account(s) to provision as SQL Server system administrators.

####sqlserver_tsql
* `command`: TSQL to execute on a potentially conditional basis
* `command`: The TSQL statement to execute.
* `onlyif`: TSQL to execute as a check to see if we should proceed and run the command parameter, should encounter a throw or error to trigger
* `instance`: SQL Server instance that we should execute against
* `instance`: The SQL Server instance you want to execute against.

### Defined Types

Expand Down