Skip to content

Instantly share code, notes, and snippets.

View LitKnd's full-sized avatar
🏠
Working from home

Kendra Little LitKnd

🏠
Working from home
View GitHub Profile
@NickCraver
NickCraver / 01. TrafficLogs.sql
Last active April 20, 2017 18:09
Setup scripts for TrafficLogs.sql - table partitioning and archive movement fun.
-- For production
--CREATE DATABASE [TrafficLogs] CONTAINMENT = NONE ON
--PRIMARY ( NAME = N'TrafficLogs', FILENAME = N'E:\Data\TrafficLogs.mdf' , SIZE = 102400000KB , FILEGROWTH = 5120000KB),
--FILEGROUP [TrafficLogs_D] ( NAME = N'TrafficLogs_D', FILENAME = N'D:\Data\TrafficLogs_D.ndf' , SIZE = 102400000KB, FILEGROWTH = 51200000KB),
--FILEGROUP [TrafficLogs_E] ( NAME = N'TrafficLogs_E', FILENAME = N'E:\Data\TrafficLogs_E.ndf' , SIZE = 1024000000KB, FILEGROWTH = 51200000KB)
--LOG ON ( NAME = N'TrafficLogs_log', FILENAME = N'D:\Data\TrafficLogs.ldf' , SIZE = 51200000KB , FILEGROWTH = 10240000KB)
--GO
-- For local development
Declare @dataPath nvarchar(500) = Cast(ServerProperty('instancedefaultdatapath') as nvarchar(500)),
@jmosbech
jmosbech / Exec-Sproc.ps1
Created May 26, 2013 19:40
Executes a Stored Procedure from Powershell and returns the first output DataTable
# Executes a Stored Procedure from Powershell and returns the first output DataTable
function Exec-Sproc{
param($Conn, $Sproc, $Parameters=@{})
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandType = [System.Data.CommandType]::StoredProcedure
$SqlCmd.Connection = $Conn
$SqlCmd.CommandText = $Sproc
foreach($p in $Parameters.Keys){
[Void] $SqlCmd.Parameters.AddWithValue("@$p",$Parameters[$p])