SQL and Support Debugging Tool Paul Johnson and Graham O’Bray.

Slides:



Advertisements
Similar presentations
Ashley Ohmann June 20, * What is Custom SQL? * What can I do with it? * Join conditions * Unions and Self Joins * Ranks * Derived Tables.
Advertisements

GP2013 (R2) New features in GP2013 (R2). New Ribbon for windows Edit List is the Print button on the right without the paper background Action pane can.
With Microsoft Access 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Introduction to Structured Query Language (SQL)
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 8 Advanced SQL.
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Introduction to Structured Query Language (SQL)
Concepts of Database Management Sixth Edition
1 Working with MS SQL Server II. 2 The sqlcmd Utility Command line utility for MS SQL Server databases. Previous version called osql Available on classroom.
Introduction to SQL J.-S. Chou Assistant Professor.
Agenda Journalling More Embedded SQL. Journalling.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 8 Advanced SQL.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
Introduction to Databases Chapter 7: Data Access and Manipulation.
Concepts of Database Management Seventh Edition
Year-End Close Procedures
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
1 Working with MS SQL Server Textbook Chapter 14.
SQL/Lesson 4/Slide 1 of 45 Using Subqueries and Managing Databases Objectives In this lesson, you will learn to: *Use subqueries * Use subqueries with.
SQL (Chapter 2: Simple queries; Chapter 7 and 8: Nested and DML queries) Many of the examples in this document are based on the tables in the next slide.
1 Definition of a subquery Nested subqueries Correlated subqueries The ISNULL function Derived tables The EXISTS operator Mixing data types: CAST & CONVERT.
Microsoft ® Business Solutions–Navision ® 4.0 Development II - C/SIDE Solution Development Day 2.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
Database Development Tr ươ ng Quý Quỳnh. References UDEMY: SQL Database MasterClass: Go From Pupil To Master! Database Systems - A Practical Approach.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 3 This material was developed by Oregon Health & Science.
Component 4/Unit 6c Topic III Structured Query Language Background information What can SQL do? How is SQL executed? SQL statement characteristics What.
Crystal And Elliott Edward M. Kwang President. Objective A brief demo of Crystal Report to entice you –People spend thousand of dollars to attend Crystal.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Intro to SQL Management Studio. Please Be Sure!! Make sure that your access is read only. If it isn’t, you have the potential to change data within your.
Module 4 Designing and Implementing Views. Module Overview Introduction to Views Creating and Managing Views Performance Considerations for Views.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Chapter 13 Views Oracle 10g: SQL. Oracle 10g: SQL2 Objectives Create a view, using CREATE VIEW command or the CREATE OR REPLACE VIEW command Employ the.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
Views, Algebra Temporary Tables. Definition of a view A view is a virtual table which does not physically hold data but instead acts like a window into.
(SQL - Structured Query Language)
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Implementing Multicurrency in an Existing Dynamics GP Environment Rod O’Connor 20-NOV-2014.
There’s a particular style to it… Rob Hatton
Advanced Database & Client Server Introduction to MS SQL Server 2000 and Transact SQL -
 CONACT UC:  Magnific training   
What you need to build your own SQL Queries Data Connection Server Name Database Name Table and Field Names SQL or Windows (AD) Account Query Tool.
CSC314 DAY 9 Intermediate SQL 1. Chapter 6 © 2013 Pearson Education, Inc. Publishing as Prentice Hall USING AND DEFINING VIEWS  Views provide users controlled.
Jeremy Kingry, eBECS | ADVANCED SQL SERVER FOR ADMINS AND ANALYSTS.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Module 5: Working with Subqueries. Writing Basic Subqueries Writing Correlated Subqueries Comparing Subqueries with Joins and Temporary Tables Using Common.
IFS180 Intro. to Data Management Chapter 10 - Unions.
#GPUGSummit | #INreno15 #GPUGSummit DATA TO YOUR PEOPLE: USING SSRS WITH DYNAMICS GP Adam Jacobson, Red Three Consulting.
Reporting in Microsoft Dynamics GP
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Dynamics GP SmartList and SmartList Designer
MySQL Subquery Source: Dev.MySql.com
Relational Database Design
Database Systems: Design, Implementation, and Management Tenth Edition
STEVE ENDOW, MCP, MCT, MVP Christina Phillips, mcp, mct, mvp
Using SQL to Prepare Data for Analysis
Dynamics GP Overview. Dynamics GP Overview.
Introduction To Structured Query Language (SQL)
Contents Preface I Introduction Lesson Objectives I-2
Chapter 8 Advanced SQL.
Navigating Your GP Data
Database Systems: Design, Implementation, and Management Tenth Edition
September 12-14, 2018 Raleigh, NC.
Extend Excel with Smartlist Designer
DIY GP Maintenance Paul Johnson.
Professional Services Tools Library (PSTL)
Topics Today Capability Efficiency Troubleshooting
Presentation transcript:

SQL and Support Debugging Tool Paul Johnson and Graham O’Bray

What’s You SQL IQ? Level 1 Select * from RM00101 Level 2 Update RM00101 set SLPRSNID=‘TOM’ where [STATE]=‘TX’ Level 3 Update c set c.COMMENT1 = dtInvCount.Invoices from RM00101 c join (Select CUSTNMBR, count(SOPNUMBE) as Invoices from SOP30200 group by CUSTNMBR) as dtInvCount on dtInvCount.CUSTNMBR = c.CUSTNMBR

Or are you…. Level 4 With cteCustTotals (CUSTNMBR, CUSTNAME, TotalAmount) as (Select c.CUSTNMBR, c.CUSTNAME, sum(s.DOCAMNT) as TotalAmount from RM00101 c join SOP30200 s on s.CUSTNMBR = c.CUSTNMBR and s.SOPTYPE = 3 group by c.CUSTNMBR, c.CUSTNAME) Select CUSTNMBR, CUSTNAME, TotalAmount, case when TotalAmount < 1000 then '1' when TotalAmount < 5000 THEN '2' when TotalAmount < then '3‘ when TotalAmount < then '4' when TotalAmount < then '5' else '6' end as CustLevel from cteCustTotals order by TotalAmount

Safe Query Development Rogue SQL Queries Minimize impact on production databases TOP N Clause WITH (NO LOCK) WHERE clause

Joins and Table Aliases Table aliases Provide plain language reference Easier to understand, follow scripts Simplifies joins Can also use field aliases

Joins and Table Aliases Combine Data from multiple tables/views with JOIN INNER LEFT OUTER RIGHT OUTER FULL OUTER CROSS JOIN Include components JOIN and ON

Handy SQL Keywords Comments: -- OR /* */ DISTINCT SELECT DISTINCT CUSTNMBR FROM SOP30200 RTRIM, for spaces SELECT RTRIM(CUSTNAME) AS : SELECT RTRIM(CUSTNAME) AS CUSTNAME CASE WHEN ELSE Example Later! LIKE WHERE CUSTNMBR LIKE ‘AA%’

Handy SQL Keywords (2) HAVING with GROUP BY GROUP BY CUSTNMBR HAVING COUNT (*) > 10 ORDER BY ORDER BY CUSTNMBER ISNULL ISNULL(ACTIDX, ‘None’) IN WHERE ACTIDX IN (3, 45, 56, 62) EXISTS WHERE EXISTS (SELECT * FROM…WHERE =)

Handy SQL Keywords (3) UNION Example Later! SUM, COUNT, MIN, MAX Used with GROUP BY, SUM(CUSTBLNC) BETWEEN WHERE CUSTBLNC BETWEEN AND Replaces >= and <= SELECT TOP SELECT TOP (10) PERCENT WITH TIES

Subqueries Query within a query or “nested” query Can be embedded in… Single Field Where Clause

Common Table Expressions Referred to as “CTE”s Allow you to setup complex subqueries separately Creates “tables” of information on the fly Temporary result set Nested SELECT statements Similar to a derived table but Self-reference Reference multiple times

More Demo Time! UPDATE with JOINS Multiple JOINS Comparisons (IN, NOT IN, WHERE NOT EXISTS) Information_Schema CASE WHEN ELSE Parameters UNION/UNION ALL PIVOT Views and Stored Procedures

Partition with ROWNUM ROW NUMBER allows for sequential numbering of records, RANK can be used instead for ranking OVER () stipulates the window over which the row numbering or ranking occurs PARTITION BY applies grouping without summarizing, to “reset” ranking or row numbering Can be based on a single field, or multiple fields

Finding Data

Dynamics GP Table Naming Structured as: a 2 or 3 character module code Followed by a 5 digit number Module code Ex. RM00101

Dynamics GP Table Naming More module code examples Payables Management – PM General Ledger – GL Inventory Control – IV

Dynamics GP Table Naming The first digit represents the table type Master – 0 Work – 1 Open – 2 Table History – 3 Ex. RM0010

Dynamics GP Table Naming The second and third digits are sequences. Sequence Number Ex. RM00101 Variants The fourth and fifth digits are variants.

Table Naming ModuleModule Code Cash ManagementCM General LedgerGL Inventory ControlIV InvoicingIVC Multicurrency ManagementMC Payables ManagementPM Purchase Order ProcessingPOP Receivables ManagementRM Sales Order ProcessingSOP System ManagerSM

Table Naming Table TypeValue Master0 Work1 Open2 History3 Setup4 Temp5 Relation6 Report Options7

Dynamics GP Field Naming Earlier GP versions were limited to 8 character names Ex. Customer Number – CUSTNMBR

Dynamics GP Views A view is a virtual table Cannot hold information, but will query tables and present data differently Can join multiple tables: Ex. Open and history

Finding Tables and Fields Inside GP, click: Tools > Resource Descriptions Support debugging tool: Tools > Support Debugging Tool – Debugger Menu > Resource Information SQL Management Studio

Data Table Resources Listing of commonly used tables and good explanations of fields where index numbers are used (ex. SOP Document Type: Quote = 1, Order = 2, invoice = 3)

Tools used to write Statements SSMS – SQL Server management studio Support debugging tool (Sql execute) Many other free tools Need to create a connection to database

Finding GP data using SDTL Use the Resource information menu in the support debugging tool

Changing Company Colours Found under administrator settings Debugger.xml file must be available to all workstations for this to work. Debugger location is set in Dex.ini setting. Under pathname location

Audit security Security Profiler Security Information

Capture screenshots Sent a copy of dex.ini, set file and system file to system admin Can reduce support costs. All users have access to this

Q&A Thanks for Attending Paul Johnson Password: UserGroup2014