SQL Tips and Tricks for Dynamics GP. Lisa Williams and Darrell Moy



Similar documents
PCSchool SQL Backup Tech Tip. SQL Backup Tech Tip. Created in version /9

SQL Database Administration. Overview

Microsoft SQL Server Scheduling

AuditWizard v8. SQL Maintenance

Understanding and Controlling Transaction Logs

Course Syllabus. Microsoft Dynamics GP Installation & Configuration. Key Data. Introduction. Audience. At Course Completion

GO!NotifyLink. Database Maintenance. GO!NotifyLink Database Maintenance 1

Siemens Teamcenter Oracle -to-sql Server 2008 Migration Guide

Restoring SQL Server Database after Accidental Deletion of.mdf File. SQL Server /06/2016

SQL Server Developer Training Program. Topics Covered

Moving the Web Security Log Database

Microsoft. Course 20463C: Implementing a Data Warehouse with Microsoft SQL Server

Microsoft Business Contact Manager Complete

mylittleadmin for MS SQL Server Quick Start Guide

David Dye. Extract, Transform, Load

Jason S Wong Sr. DBA IT Applications Manager DBA Developer Programmer M.S. Rice 88, MBA U.H. 94(MIS)

ArcGIS Server and Geodatabase Administration for 10.2

Notes Transfer instructions INTRODUCTION More information

The safer, easier way to help you pass any IT exams. Exam : C_HANASUP_1. SAP Certified Support Associate - SAP HANA 1.0.

BACKING UP A DATABASE

6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

SPHOL207: Database Snapshots with SharePoint 2013

How to Backup Your Eclipse.Net Database Automatically. To clearly document a specific automatic SQL database backup method for Eclipse.net.

Database Maintenance Guide

SQL Server Replication Guide

Microsoft Dynamics GP. Professional Services Tools Library Release 10.0 Feature Pack 1

MOC 20462C: Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server Databases

Company Data Archive Version 9.0

How to protect, restore and recover SQL 2005 and SQL 2008 Databases

SQL Server Training Course Content

Moving the TRITON Reporting Databases

Dynamics GP 50 Tips in 50 Minutes

Audit TM. The Security Auditing Component of. Out-of-the-Box

Database as a Service (DaaS) Version 1.02

FaxCore 2007 Application-Database Backup & Restore Guide :: Microsoft SQL 2005 Edition

CRG Academy Course Descriptions. Corporate Renaissance Group 6 Antares Drive, Phase 1, Suite 200 Ottawa, ON K2E 8A9

General DBA Best Practices

Module 07. Log Shipping

HELP DOCUMENTATION E-SSOM BACKUP AND RESTORE GUIDE

Keystone Enterprise Backup

High Availability for Oracle 8 Using Double-Take

You will be prompted for a password for the postgres user. In the example below,

Database Maintenance Essentials

MOC Administering Microsoft SQL Server 2014 Databases

How to restore a Microsoft SQL Server Master Database with Backup Exec for Windows Servers (Automate Master Database Restore)

Database Administrator Certificate Capstone Project Evaluation Checklist

Mass Billing An application for Microsoft Dynamics ΤΜ GP Furthering your success through innovative business solutions

Microsoft SQL Database Administrator Certification

Microsoft Dynamics GP Audit Trails

Backup and Recovery of SAP Systems on Windows / SQL Server

50238: Introduction to SQL Server 2008 Administration

Matisse Installation Guide for MS Windows. 10th Edition

SQL Tuning and Maintenance for the Altiris Deployment Server express database.

Working with SQL Server Agent Jobs

Technical Script AIST3410 Database Management systems p 1

Restoring Microsoft SQL Server 7 Master Databases

SQL SERVER FREE TOOLS

Utilities ComCash

Visual COBOL ASP.NET Shopping Cart Demonstration

SQM. Maintaining Microsoft SQL for Broadcast Engineers. Training Course Outline

High Availability for Microsoft SQL Server Using Double-Take 4.x

High Availability for Internet Information Server Using Double-Take 4.x

STIDistrict SQL 2000 Database Management Plans

Introduction to Microsoft Access 2003

NUTECH COMPUTER TRAINING INSTITUTE 1682 E. GUDE DRIVE #102, ROCKVILLE, MD WEB: TEL:

ADMINISTERING MICROSOFT SQL SERVER DATABASES

USING FILERELICATIONPRO TO REPLICATE SQL SERVER

Administering Microsoft SQL Server Databases

Table of Contents SQL Server Option

MS Administering Microsoft SQL Server Databases

High Availability for Microsoft SQL Server 7.0 Using Double-Take

DeltaV Event Chronicle

GP REPORTS VIEWER USER GUIDE

Norman Secure Backup. SQL Backup Training Guide. Author: Arne Stieghorst Layout: Eva Langballe

Database Maintenance ZENworks Mobile Management 2.7.x August 2013

ImageNow for Microsoft SQL Server

EVENT LOG MANAGEMENT...

Administering Microsoft SQL Server Databases 20462C; 5 days

CONVERTING FROM NETKEEPER ISAM v6.32 to NETKEEPER SQL

Administering Microsoft SQL Server Databases

Administering Microsoft SQL Server Databases

SQL Server 2008 R2 (Pubs, Subs, and Other Replication Appetizers)

AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014

Vector HelpDesk - Administrator s Guide

Performance. Optimizing Performance. Microsoft Dynamics CRM 3.0. White Paper. Date: January 10,

Workflow Templates Library

Microsoft SQL Server OLTP Best Practice

Handling a Full SQL Server Transaction Log

MS SQL Server Database Management

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

Monitoring System Status

AUTODESK DATA MANAGEMENT SERVER Advanced Configuration Guide for Autodesk Data Management Server 2008

SQL Server 2008 Designing, Optimizing, and Maintaining a Database Session 1

Netezza Workbench Documentation

SQL Server 2014

SQL Server Maintenance Plans

Transcription:

for Dynamics GP Lisa Williams and Darrell Moy

Agenda 1. SQL Database Maintenance Plans 2. SQL Jobs Check job status 3. Creating a view for custom SmartList & Reporting 4. Create SQL script using Mail Merge 5. How to make SQL prod back up and restore to test 6. View Batch status and reset stuck batch 7. Back up table before changing contents 8. Copy and Paste Header with Data in SQL Management Studio 9. Find all tables containing column name 10. Truncating the transaction log 11. Some SQL Scripts for data extractions (demo)

IMPORTANT: Commands with UPDATE, DELETE or DROP can ruin your data! Please use these queries with caution. We highly recommend that you backup your database before trying out these commands and to use them first on a test server and/or database. Use at your own risk.

1. SQL Maintenance Plans Database Backups Check Data Integrity Reorganize Index Rebuild Index Update Statistics Cleanup history

2. Check for failed jobs Job types Backups Maintenance Plans Business Alerts SQL Integration services SQL Server Agent Service that runs on server to automate jobs Not available on SQL Express Job Activity Monitor

3. Creating Views Selection of records from SQL table(s) that can be used for various purposes: Custom SmartList Objects Crystal Reports Custom Excel Reports Provides mechanism to join data from multiple tables, create calculated fields, and transform data

4. Mail Merge (MS Word) Mass update, insert of SQL records Data in Excel Query in Word MailMerge to directory Paste results into query window

5. Make a test Company from copy of Production Create test company in GP Set proper security permissions Backup live company in SQL Restore backup of live company in SQL Set the proper file name and location Run SQL script to update test company Refer to Knowledgebase article 871973 See Sample Script

6. Check stuck batch status and resolution Run SQL query to view current activity Select * from DYNAMICS..ACTIVITY Select * from DYNAMICS..SY00800 Select * from DYNAMICS..SY00801 Run SQL query to view status of stuck batch Select BCHSTTUS, MKDTOPST, * from SY00500 Refer to Knowledgebase article 852420 Resolution All users out of GP Update SY00500 Set MKDTOPST=0, BCHSTTUS=0 where BACHNUMB = 'XXX'

7. Back up table before changing contents Copy table structure and data into backup table Use when updating data in live databases Example: using Customer Master table Select * into RM00101_Backup from RM00101

8. Copy and Paste Header with Data in SQL Management Studio SQL Management Studio doesn t copy headers with data by default Useful for copying query results from query grid into Excel Change Setting in Tools Options Query Results SQL Server Results to Grid check the box "Include Column headers when copying or saving the results." http://msdynamicsgp.blogspot.com/2009/10/weekly-dynamic-copy-headings-anddata.html

9. Find all tables containing column name Example using Account Index field SELECT DISTINCT RTRIM(objs.NAME) FROM sys.columns cols INNER JOIN sys.objects objs on (cols.object_id = objs.object_id) INNER JOIN sysindexes indx on (cols.object_id = indx.id) WHERE (cols.name = 'ACTINDX') and (objs.type = 'U') and (indx.rowcnt <> 0)

10. Truncating the transaction log Log files expand and occupy disk space SQL errors in GP when disk if full Run manually or use SQL jobs Use Dynamics BACKUP LOG DYNAMICS with TRUNCATE_ONLY Use Dynamics DBCC SHRINKFILE (2, 10) --2 means log file --10 means the size

Inventory SQL Query Display quantity on hand, allocated and remaining inventory level (IV00102) Demo script: -- LIST SUMMARY COUNTS REGARDLESS OF LOCATION select itemnmbr, qtyonhnd AS MYITEMS_ONHAND, atyalloc AS MYALLOCATEDITEMS, qtyonhnd-atyalloc AS REMAINING_QTYS from iv00102 where rcrdtype=1 order by itemnmbr, locncode -- LIST SUMMARY COUNTS DEPENDING ON LOCATION select itemnmbr, locncode AS LOCATION, qtyonhnd AS MYITEMS_ONHAND, atyalloc AS MYALLOCATEDITEMS, qtyonhnd-atyalloc AS REMAINING_QTYS from iv00102 where rcrdtype=2 order by itemnmbr, locncode

How profitable are each of your customers? Demo script: Script to view how profitable your customer is; declare @Year as varchar(22) set @Year = 2017 select a.custnmbr, c.custname,b.sopnumbe,a.docdate,b.xtndprce Extended_Price, (b.quantity * b.unitcost) Extended_Cost, (b.xtndprce - (b.quantity * b.unitcost)) Profit, round((b.xtndprce - (b.quantity * b.unitcost))/nullif(b.xtndprce,0),0,2) as Gross_Margin from SOP30200 a (NOLOCK), SOP30300 b (NOLOCK), RM00101 c (NOLOCK) where a.sopnumbe=b.sopnumbe and a.soptype=3 and a.custnmbr=c.custnmbr and DATEPART(Year, a.docdate) = @Year order by a.custnmbr,a.sopnumbe

for Dynamics GP Thank You for Attending!