Presentation is loading. Please wait.

Presentation is loading. Please wait.

Developing Production Quality SQL Code

Similar presentations


Presentation on theme: "Developing Production Quality SQL Code"— Presentation transcript:

1 Developing Production Quality SQL Code
Paul Nielsen Founder, Ministry Weaver, inc SQL Server MVP SQL Server 2008 Bible

2 Goals Share ideas for better code
Strengthen your defense as SQL Developers in your team Set GoFaster = 1

3 Culture Fix bugs before you add new features
Configure with Meta-data, never customize with code Everyone Tests Stress Test Test more No single head of knowledge – shadow, cross train

4 Script Everything Script 1: Schema, TVP Types, Sequences, Indexes, Triggers, Basic Data Script 2: Procs, Functions Script 3: Test Data Script 4: Proc Execution Name all constraints

5 Integrity Normalize the design TVPs for wrapping multiple transactions
Every FK defined API doc: Describe the Procs with Extended Properties

6 Security & Permissions
Lock down the tables, app can only execute procs Use schemas for granting rights, Never use dbo. Authenticate every proc - user and session Timeout sessions - job Log the actions Hash + Salt the Password Encrypt in flight and at rest Parameterize the Query Row-based Permissions

7 Error Handling Standardize your Try/Catch,
Standardize error trapping, error logging, error reporting Return errors with Return Codes Avoid SQL errors defaults Be careful with data types returned and nulls

8 Performance Normalize the design
Use de-normalized Helper tables for performance Dynamic SQL for the perfect SQL String - parameterize Log the search durations Use the right data type Index carefully Standardize your paging Chunky not chatty

9 Many Thanks Linked In


Download ppt "Developing Production Quality SQL Code"

Similar presentations


Ads by Google