вход по аккаунту

код для вставкиСкачать
Developing Production
Quality SQL Code
Paul Nielsen
Founder, Ministry Weaver, inc
SQL Server MVP 2004 SQL Server 2008 Bible
Share ideas for better code
Strengthen your defense as SQL Developers in your
Set GoFaster = 1
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
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
Normalize the design
TVPs for wrapping multiple transactions
Every FK defined
API doc: Describe the Procs with Extended Properties
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
Error Handling
Standardize your Try/Catch,
Standardize error trapping, error logging, error
Return errors with Return Codes
Avoid SQL errors with @Parameter defaults
Be careful with data types returned and nulls
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
Many Thanks
[email protected]
Linked In
Пожаловаться на содержимое документа