SlideShare a Scribd company logo
Getting Your DB Schema
Under Control With SSDT
Peter A. Schott
Our Niche
“We provide senior level DBAs
to support to our customers for
maximum flexibility in a model
that aligns costs with usage.”
Service Features
 Experienced, Assigned DBAs
 100% U.S. Citizens
 Direct Contact with DBAs
 24x7 Incident Response
 Integrated operational monitoring (optional)
 Performance monitoring/assessment (optional)
 Weekly Activity/Usage Reports
Service Benefits
 Scalable DBA extension to team
 No hiring or training costs
 Pay-for-use model
Intro to SSDT
What is SSDT?
Brief history
Why would you use it?
SSIS
SSAS
SSRS
Databases
Installing SSDT
Official source – Microsoft SSDT or VS
Use “Chocolatey”
Don’t need VS installed – will install a VS shell or
Community Edition
Only install components/extensions you need/use
DB Projects installed by default
DB Projects also included in full Visual Studio 2015+
installs
Visual Studio 2019
Visual Studio
2019 started
using
Extensions.
Modify your
install to add
SSDT
Demo Time!
Creating Your First Project
Standard VS Shell
SQL Projects
May want to consider
Templates
Demo
Now What?
Empty projects don’t
give you a lot of
guidance
Creating objects in an
empty project can lead
to poor structure
For best results,
consider Importing
Demo
Importing Your Database Objects
Pulls in
everything
Gives you a
good starting
structure
You’ll find lots of
things to fix
Demo
Exploring the Project
Import creates folders for
schema and object types
Objects are saved as CREATE
scripts
Database Properties
Renames are handled in the
RefactorLog (created when
needed)
Demo
Common Errors and Issues After Import
3-Part DB Names (current database)
Cross-database views/functions/procs
Linked Server references
Users/Logins not often the same in all environments
Dealing with 3-Part DB Names – Current DB
SSDT doesn’t know the current database name
Find/Replace is your friend
Limit to *.sql files
Variations
DBName.dbo.
DBName..
[DBName].[dbo].
etc.
Cross-Database Objects
Database References
Use a common storage
location
May need to use
SQLPackage to extract a
dacpac
Watch your variable
settings!
Linked Servers
Similar to Cross-Database objects
Set your options and variables
appropriately
Doesn’t seem to work well w/ OPENQUERY
Users/Logins
Easiest to ignore initially
Use DB Roles
Import puts these in the “Security” folder
If you really need this, there are ways…
https://schottsql.com/2013/05/14/ssdt-setting-different-
permissions-per-environment/
Kudos to Jamie Thomson for the idea
Back to the
Project!
Building and Publishing
Build
If all obvious errors are fixed, try to build
Fix any errors that come up
Fix warnings as you can
Deploy
Create Publish Profiles for common environments
Pick the appropriate options for your database
Try not to use too many “ignore” options
Demo
Adding New Objects
Watch the file properties (build, none, etc.)
Add as CREATE
Only ALTERs tend to be Constraints and Keys
Try to use standard locations
Follow general folder structure for project
Can also Import or Compare
If an “ignored scripts” file is created, look at it!
Demo
Pre and Post Deploy Scripts
Special script type, only one of each allowed
Uses SQLCMD calls for other scripts
Can use files not in the project
Demo
Snapshots
Saves dacpac of given project state
Possible Uses:
Save a specific version of your project to use for release
Save version of the project before making major changes
Use as a source for schema compare
Baseline your project
Roll back to this state
Demo
Version Control
Similar to other code
Check in non-user-specific files
Can branch, merge, check-out, etc.
If using Git, use a .gitignore file
https://github.com/github/gitignore
Watch out for “*.publish.xml” if saving Publish Profiles
Demo
Command Line
Build using MSBuild or PowerShell
Deploy using SQLPackage or PowerShell
Can generate Diff Reports as part of the process
Useful for gated builds
Demo
Potential Gotchas
Large numbers of objects
External databases
Users and Permissions
Rollbacks
SQL Server-only features such as FileStream
Where to Get Help
Stack Overflow:
https://stackoverflow.com/questions/tagged/ssdt
MS Forums:
https://social.msdn.microsoft.com/Forums/sqlserver/en-
US/home?forum=ssdt&forum=ssdt
SQL Community Slack:
https://sqlps.io/slack/
Questions?
Peter Schott | @paschott
paschott@outlook.com
http://schottsql.com
Files:
https://github.com/paschott/SSDT_101
Rate this presentation:
http://spkr8.com/t/75511

More Related Content

Similar to Getting Your DB Schema Under Control With SSDT.pptx

2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...
2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...
2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...
Bhavik Merchant
 
XML2Selenium Technical Presentation
XML2Selenium Technical PresentationXML2Selenium Technical Presentation
XML2Selenium Technical Presentation
jazzteam
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
Concentrated Technology
 
Features & Installation Profiles
Features & Installation ProfilesFeatures & Installation Profiles
Features & Installation Profiles
David Watson
 
Azure Data Studio Extension Development
Azure Data Studio Extension DevelopmentAzure Data Studio Extension Development
Azure Data Studio Extension Development
Drew Skwiers-Koballa
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
Sayed Ahmed
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schema
Sayed Ahmed
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
Sayed Ahmed
 
Best practice adoption (and lack there of)
Best practice adoption (and lack there of)Best practice adoption (and lack there of)
Best practice adoption (and lack there of)
John Pape
 
Azure presentation nnug dec 2010
Azure presentation nnug  dec 2010Azure presentation nnug  dec 2010
Azure presentation nnug dec 2010
Ethos Technologies
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepins
Linards Liep
 
Isset Presentation @ EECI2009
Isset Presentation @ EECI2009Isset Presentation @ EECI2009
Isset Presentation @ EECI2009
Isset Internet Professionals
 
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
Wolfgang Strasser
 
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 EditionEnter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
Mark Broadbent
 
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
Joel Oleson
 
CCC 2015 tfs admin for good not evil
CCC 2015 tfs admin for good not evilCCC 2015 tfs admin for good not evil
CCC 2015 tfs admin for good not evil
Angela Dugan
 
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 MelbourneAzure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Michael Noel
 
[Noel] Azure AD Connect Technical Deep Dive
[Noel] Azure AD Connect Technical Deep Dive[Noel] Azure AD Connect Technical Deep Dive
[Noel] Azure AD Connect Technical Deep Dive
European Collaboration Summit
 
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Michael Noel
 
SPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
SPS Lisbon 2018 - Azure AD Connect Technical Deep DiveSPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
SPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
Michael Noel
 

Similar to Getting Your DB Schema Under Control With SSDT.pptx (20)

2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...
2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...
2012-04-28 (SQL Saturday 140 Perth) Migrating Deployment and Config to SSIS 2...
 
XML2Selenium Technical Presentation
XML2Selenium Technical PresentationXML2Selenium Technical Presentation
XML2Selenium Technical Presentation
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
 
Features & Installation Profiles
Features & Installation ProfilesFeatures & Installation Profiles
Features & Installation Profiles
 
Azure Data Studio Extension Development
Azure Data Studio Extension DevelopmentAzure Data Studio Extension Development
Azure Data Studio Extension Development
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schema
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Best practice adoption (and lack there of)
Best practice adoption (and lack there of)Best practice adoption (and lack there of)
Best practice adoption (and lack there of)
 
Azure presentation nnug dec 2010
Azure presentation nnug  dec 2010Azure presentation nnug  dec 2010
Azure presentation nnug dec 2010
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepins
 
Isset Presentation @ EECI2009
Isset Presentation @ EECI2009Isset Presentation @ EECI2009
Isset Presentation @ EECI2009
 
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
Professional Recycling - SSIS Custom Control Flow Components With Visual Stud...
 
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 EditionEnter the Dragon -  SQL 2014 on Server Core PASS Summit 2014 Edition
Enter the Dragon - SQL 2014 on Server Core PASS Summit 2014 Edition
 
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
 
CCC 2015 tfs admin for good not evil
CCC 2015 tfs admin for good not evilCCC 2015 tfs admin for good not evil
CCC 2015 tfs admin for good not evil
 
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 MelbourneAzure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
Azure Active Directory Connect: Technical Deep Dive - DWCAU 2018 Melbourne
 
[Noel] Azure AD Connect Technical Deep Dive
[Noel] Azure AD Connect Technical Deep Dive[Noel] Azure AD Connect Technical Deep Dive
[Noel] Azure AD Connect Technical Deep Dive
 
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
Azure Active Directory Connect: Technical Deep Dive - EU Collab Summit 2018
 
SPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
SPS Lisbon 2018 - Azure AD Connect Technical Deep DiveSPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
SPS Lisbon 2018 - Azure AD Connect Technical Deep Dive
 

Recently uploaded

Module 1 ppt BIG DATA ANALYTICS NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS NOTES FOR MCA
yuvarajkumar334
 
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
ywqeos
 
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
asyed10
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
uevausa
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
Vietnam Cotton & Spinning Association
 
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
slg6lamcq
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdfOverview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
nhutnguyen355078
 
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
mkkikqvo
 
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
actyx
 
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
eoxhsaa
 
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
9gr6pty
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
aguty
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
hqfek
 
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
z6osjkqvd
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
ytypuem
 
Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
blueshagoo1
 
ML-PPT-UNIT-2 Generative Classifiers Discriminative Classifiers
ML-PPT-UNIT-2 Generative Classifiers Discriminative ClassifiersML-PPT-UNIT-2 Generative Classifiers Discriminative Classifiers
ML-PPT-UNIT-2 Generative Classifiers Discriminative Classifiers
MastanaihnaiduYasam
 
Drownings spike from May to August in children
Drownings spike from May to August in childrenDrownings spike from May to August in children
Drownings spike from May to August in children
Bisnar Chase Personal Injury Attorneys
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
ElizabethGarrettChri
 

Recently uploaded (20)

Module 1 ppt BIG DATA ANALYTICS NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS NOTES FOR MCA
 
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
一比一原版(lbs毕业证书)伦敦商学院毕业证如何办理
 
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
 
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
一比一原版加拿大渥太华大学毕业证(uottawa毕业证书)如何办理
 
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
[VCOSA] Monthly Report - Cotton & Yarn Statistics March 2024
 
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdfOverview IFM June 2024 Consumer Confidence INDEX Report.pdf
Overview IFM June 2024 Consumer Confidence INDEX Report.pdf
 
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
原版一比一多伦多大学毕业证(UofT毕业证书)如何办理
 
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
一比一原版斯威本理工大学毕业证(swinburne毕业证)如何办理
 
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
一比一原版多伦多大学毕业证(UofT毕业证书)学历如何办理
 
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
一比一原版(uob毕业证书)伯明翰大学毕业证如何办理
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
 
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
一比一原版英属哥伦比亚大学毕业证(UBC毕业证书)学历如何办理
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
 
Econ3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdfEcon3060_Screen Time and Success_ final_GroupProject.pdf
Econ3060_Screen Time and Success_ final_GroupProject.pdf
 
ML-PPT-UNIT-2 Generative Classifiers Discriminative Classifiers
ML-PPT-UNIT-2 Generative Classifiers Discriminative ClassifiersML-PPT-UNIT-2 Generative Classifiers Discriminative Classifiers
ML-PPT-UNIT-2 Generative Classifiers Discriminative Classifiers
 
Drownings spike from May to August in children
Drownings spike from May to August in childrenDrownings spike from May to August in children
Drownings spike from May to August in children
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
 

Getting Your DB Schema Under Control With SSDT.pptx

  • 1. Getting Your DB Schema Under Control With SSDT Peter A. Schott
  • 2. Our Niche “We provide senior level DBAs to support to our customers for maximum flexibility in a model that aligns costs with usage.” Service Features  Experienced, Assigned DBAs  100% U.S. Citizens  Direct Contact with DBAs  24x7 Incident Response  Integrated operational monitoring (optional)  Performance monitoring/assessment (optional)  Weekly Activity/Usage Reports Service Benefits  Scalable DBA extension to team  No hiring or training costs  Pay-for-use model
  • 3. Intro to SSDT What is SSDT? Brief history Why would you use it? SSIS SSAS SSRS Databases
  • 4. Installing SSDT Official source – Microsoft SSDT or VS Use “Chocolatey” Don’t need VS installed – will install a VS shell or Community Edition Only install components/extensions you need/use DB Projects installed by default DB Projects also included in full Visual Studio 2015+ installs
  • 5. Visual Studio 2019 Visual Studio 2019 started using Extensions. Modify your install to add SSDT
  • 7. Creating Your First Project Standard VS Shell SQL Projects May want to consider Templates Demo
  • 8. Now What? Empty projects don’t give you a lot of guidance Creating objects in an empty project can lead to poor structure For best results, consider Importing Demo
  • 9. Importing Your Database Objects Pulls in everything Gives you a good starting structure You’ll find lots of things to fix Demo
  • 10. Exploring the Project Import creates folders for schema and object types Objects are saved as CREATE scripts Database Properties Renames are handled in the RefactorLog (created when needed) Demo
  • 11. Common Errors and Issues After Import 3-Part DB Names (current database) Cross-database views/functions/procs Linked Server references Users/Logins not often the same in all environments
  • 12. Dealing with 3-Part DB Names – Current DB SSDT doesn’t know the current database name Find/Replace is your friend Limit to *.sql files Variations DBName.dbo. DBName.. [DBName].[dbo]. etc.
  • 13. Cross-Database Objects Database References Use a common storage location May need to use SQLPackage to extract a dacpac Watch your variable settings!
  • 14. Linked Servers Similar to Cross-Database objects Set your options and variables appropriately Doesn’t seem to work well w/ OPENQUERY
  • 15. Users/Logins Easiest to ignore initially Use DB Roles Import puts these in the “Security” folder If you really need this, there are ways… https://schottsql.com/2013/05/14/ssdt-setting-different- permissions-per-environment/ Kudos to Jamie Thomson for the idea
  • 17. Building and Publishing Build If all obvious errors are fixed, try to build Fix any errors that come up Fix warnings as you can Deploy Create Publish Profiles for common environments Pick the appropriate options for your database Try not to use too many “ignore” options Demo
  • 18. Adding New Objects Watch the file properties (build, none, etc.) Add as CREATE Only ALTERs tend to be Constraints and Keys Try to use standard locations Follow general folder structure for project Can also Import or Compare If an “ignored scripts” file is created, look at it! Demo
  • 19. Pre and Post Deploy Scripts Special script type, only one of each allowed Uses SQLCMD calls for other scripts Can use files not in the project Demo
  • 20. Snapshots Saves dacpac of given project state Possible Uses: Save a specific version of your project to use for release Save version of the project before making major changes Use as a source for schema compare Baseline your project Roll back to this state Demo
  • 21. Version Control Similar to other code Check in non-user-specific files Can branch, merge, check-out, etc. If using Git, use a .gitignore file https://github.com/github/gitignore Watch out for “*.publish.xml” if saving Publish Profiles Demo
  • 22. Command Line Build using MSBuild or PowerShell Deploy using SQLPackage or PowerShell Can generate Diff Reports as part of the process Useful for gated builds Demo
  • 23. Potential Gotchas Large numbers of objects External databases Users and Permissions Rollbacks SQL Server-only features such as FileStream
  • 24. Where to Get Help Stack Overflow: https://stackoverflow.com/questions/tagged/ssdt MS Forums: https://social.msdn.microsoft.com/Forums/sqlserver/en- US/home?forum=ssdt&forum=ssdt SQL Community Slack: https://sqlps.io/slack/
  • 25. Questions? Peter Schott | @paschott paschott@outlook.com http://schottsql.com Files: https://github.com/paschott/SSDT_101 Rate this presentation: http://spkr8.com/t/75511

Editor's Notes

  1. VS DB Projects – large files, long build/compare times SSDT – split into SSDT (DB Projects) and SSDT-BI – lots of confusion. BI Projects were version-specific Current SSDT release – DB Projects, SSIS, SSAS, SSRS – can handle multiple (modern) SQL Versions This presentation – DB Projects. Why? To get control of your schema in files that can go into source control.
  2. https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt Or use Chocolately to install VS shell + ssdt. choco install visualstudio2019community choco install visualstudio2019-workload-databuildtools --package-parameters "--no-includeRecommended"
  3. choco install visualstudio2019-workload-databuildtools --package-parameters "--no-includeRecommended“
  4. Will cover the next several slides – create project, import db, explore project
  5. Launch VS New Project – type “SQL Server” Can save Templates to the VS Templates folder if you have a setup you like and want to use for everything. I’ll usually add folders in the project for “Publish” and “Schema Compare” as well as Pre/Post-deploy script folders
  6. Can only import from DB/dacpac in an empty project (or brand new template) Can always import from script, though only CREATE scripts will work. Tend to avoid importing logins and permissions – those are usually environment-specific
  7. Can create other folders as needed. I usually create a Scripts/Pre-Deploy and Scripts/Post-Deploy folder, a Publish folder, and a Schema Compare folder
  8. See next slides
  9. Sometimes the import just doesn’t work. Leave variable blank if DB name will always be the same Choose “Different Database, Different Server” for linked server dbs https://msdn.microsoft.com/en-us/library/hh550080(v=VS.103).aspx
  10. Good way to check the project and make sure that there are no major errors. Don’t try to push DB Properties to Azure SQL Allow Incompatible Platform – useful if you could push to many different versions
  11. Nuget package w/ SSDT binaries May want to force a version to avoid surprises