SlideShare a Scribd company logo
1 of 25
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 Presentationjazzteam
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAConcentrated Technology
 
Features & Installation Profiles
Features & Installation ProfilesFeatures & Installation Profiles
Features & Installation ProfilesDavid Watson
 
Azure Data Studio Extension Development
Azure Data Studio Extension DevelopmentAzure Data Studio Extension Development
Azure Data Studio Extension DevelopmentDrew Skwiers-Koballa
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schemaSayed Ahmed
 
Be a database professional
Be a database professionalBe a database professional
Be a database professionalSayed Ahmed
 
Be a database professional
Be a database professionalBe a database professional
Be a database professionalSayed 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 2010Ethos Technologies
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsLinards Liep
 
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 EditionMark 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 evilAngela 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 MelbourneMichael Noel
 
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 2018Michael 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 DiveMichael 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
 
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
 
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
 
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
 
[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
 
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

Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxolyaivanovalion
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023ymrp368
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Delhi Call girls
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 

Recently uploaded (20)

Zuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptxZuja dropshipping via API with DroFx.pptx
Zuja dropshipping via API with DroFx.pptx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023
 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 

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