Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.

Slides:



Advertisements
Similar presentations
BASIC SKILLS AND TOOLS USING ACCESS
Advertisements

Microsoft® Access® 2010 Training
ADABAS to RDBMS UsingNatQuery. The following session will provide a high-level overview of NatQuerys ability to automatically extract ADABAS data from.
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
1 After completing this lesson, you will be able to: Create a new presentation using a design template. Enter text in the Slide pane. Create a new slide.
Microsoft ® Office Access ® 2007 Training Easy Access with templates I: Create a database susanguggenheim-is.com presents:
MS Access 2003 Tutorial By: Juan GUANTENG!!! Y7. Step 1 Launch the Microsoft Access 2003 program. This can be done by clicking an icon on the desktop.
Presentation Heading – font Arial
Microsoft SQL Server 2008 From the Program menu choose: Microsoft SQL Server 2008 R2  SQL Server Management Studio. You may see a window indicating the.
Jeopardy Objects Navigation Buttons True/False Parts of a Report Vocabulary Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
The Internet. Telnet Telnet means using your computer as a terminal. All commands you type are sent to the host computer you are connected to and executed.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 1 Creating and Using a Database.
Using ERWin to model your data Supplied by Computer Associates as part of AllFusion.
Create A Visual Studio Template
® IBM Software Group © 2006 IBM Corporation The Eclipse Data Perspective and Database Explorer This section describes how to use the Eclipse Data Perspective,
XP New Perspectives on Integrating Microsoft Office XP Tutorial 1 1 Integrating Microsoft Office XP Tutorial 1 – Integrating Word and Excel.
Access Tutorial 10 Automating Tasks with Macros
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Overview What is SQL Server? Creating databases Administration Security Backup.
Advanced Forms Lesson 10.
Connecting to USF Network for Web Site SSH Secure Shell is the FTP program you will use to download your http files onto the USF server. To get the SSH.
IT 211 Project Integration and Deployment Lab #11.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
1 Integrating Microsoft Office 2003 Tutorial 2 – Integrating Word, Excel, and Access.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 2 1 Integrating Microsoft Office XP Tutorial 2 – Integrating Word, Excel, and Access.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Switchboards, PivotTables, and PivotCharts.
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
Key Applications Module Lesson 21 — Access Essentials
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
® Microsoft Office 2010 Integrating Word, Excel, Access, and PowerPoint.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Unit 5, Lesson 1 Working with Databases. Objectives Identify the parts of the Access screen. Identify the parts of the Access screen. Understand the purpose.
McGraw-Hill/Irwin ©2005 The McGraw-Hill Companies, All rights reserved ©2005 The McGraw-Hill Companies, All rights reserved McGraw-Hill/Irwin.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Creating an Application System Using Macros, Wizards, and the Switchboard.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
XP New Perspectives on Integrating Microsoft Office 2003 Tutorial 2 1 Integrating Microsoft Office 2003 Tutorial 2 – Integrating Word, Excel, and Access.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
When the program is first started a wizard will start to setup your Lemming App. Enter your company name and owner in the fields designated “Company Name”
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
Backup Tables in SQL Server. Backup table method Cape_Codd database is used in this example 1.Righ click the database that contains the table you want.
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
Creating SQL Database file And Displaying a Database Table in a DataGridView.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Chapter 7 Creating Templates, Importing Data, and Working with SmartArt, Images, and Screen Shots Microsoft Excel 2013.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
Unit 9 Seminar. Starting Reporting Services Reporting Service Started.
How To Start a SQL server Connecting to SQL Server.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 11 Creating Web Applications and Writing Data to a Database.
SQL Database Management
Using “So what is the Truth” Template
, MS-Access, QBE, Access/Oracle
Creating and Using a Database
Using JDeveloper.
Using “So what is the Truth” Template
Microsoft Office Access 2003
Accessing Databases with ADO.NET, Handling Exceptions, and Printing
These slides are for reference only. They are not "lecture notes"
Presentation transcript:

Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand the views folder. Right click on a view and select Design For stored procedures, expand the programmability folder and then the stored procedures folder. Right click on a stored procedure and select Modify

If you want to experiment with them and change them, you will have to generate and run scripts to recreate the definitions for tables, views, and stored procedures in your group database and then import the data from the base tables.

DO NOT import views using the import process described previously. It copies the views but stores the results as base tables.

The instructions that follow assume that you have NOT already copied or imported any data from the database you are scripting. If you have, delete all of those tables before following these instructions.

Generate scripts for tables, views, and stored procedures Right click on the source database and select tasks  Generate Scripts. A script wizard appears; click Next.

Click the radio button associated with Select specific database objects Select all of the tables, views, and stored procedures ONLY! DO NOT select anything else. Note: a checkbox for views and stored procedures will only appear if the database has views or stored procedures. Click Next.

A window showing script options appears. Click on the Advanced button. There is an option under General that reads Script USE DATABASE. Set its property to False. Click OK. Select the radio button associated with Save to Clipboard. Click next

A summary window appears showing your selections. If they are all correct click the Next button and the Finish button. You have now generated a script (SQL commands to create tables, views, and stored procedures) and it’s on the clipboard.

You now have to run this script. To do this: Select your destination database. Right click and select New Query. Into the query window paste the script you previously saved on the clipboard.

Click the execute button above the above the stored procedure tab (the red !) This will create all the tables, views, and stored procedures that were in the source database. Refresh your connection in the object explorer window and you should be able to see the tables, views, and stored procedures.

You can close the script window without saving it. You don’t need it anymore. NOTE: the tables are created but they have no data. Populating a table with data is a different process.

At this point you should import data from the base tables in the source database as described in a previous powerpoint file. Remember to import ONLY the base tables.

NOTE: It is difficult to predict the order in which tables will be imported. It’s possible that the wizard could try to import a table containing foreign keys first. If it does this, it is a violation of a referential integrity rule.

To be on the safe side you should import tables using a two step process. 1. Import ONLY the tables that DO NOT contain a foreign key. 2. Then import ONLY the tables that contain a foreign key.

To see a view definition, expand the views folder, right click on a view, and select Design. You can see the results of the view by clicking on the ! In the tool bar above the explorer window.

Creating Stored Procedures Expand the Programmability folder under your database. Right click on the Stored Procedure entry in your database and select New Stored Procedure. You will get a template for writing code. Typing ctrl  shift  M allows you to enter parameters to the template.

Or you can just enter your code using logic similar to that in the stored procedures in the demo databases. To execute the code that creates the stored procedure, click execute (also the red !) in your tool bar. NOTE: This is NOT executing the stored procedure. Your stored procedure is created

To modify a stored procedure, find the stored procedure name as above, right click, and select modify. Makes changes as necessary and again click execute as before. When you close the window you’ll be asked if you want to save changes to a listed sql file. This is not necessary if you’ve done the previous step.

Testing a Stored Procedure from Visual Studio 2010 Start Visual Studio.NET 2010 Close the Start Page if it appears. Select View  Server Explorer Right click on data Connection and select Add Connection.

You may or may not see a small window with the title Choose Data Source. If you do then select Microsoft SQL Server. In the Data Provider drop down menu, select.NET Framework Data Provider for SQLServer Click the Continue button.

You should see a window with the title Add Connection and the Data source should specify Microsoft SQL Server (SQLClient). If it doesn’t use the Change button to access the Change Data Source window and proceed as in the previous slide. Otherwise proceed to the next step.

Select ICSD for the server name. Select the radio button Use Windows Authentication. Select your group database name. Click OK

In the Server Explorer pane expand the new connection entry and the Stored Procedures folder Double click on the stored procedure you want to run. Its code should appear in a window.

Right click on the stored procedure name in the server explorer window and select Execute. A window will appear that allows you to enter values for parameters that are passed to the stored procedure. Enter the parameter information; click OK.

You can verify that it worked by going back to management studio and viewing the table

There is a debug ability that allows a user to step through a stored procedure. To allow this, student logins MUST be added to the sysadmin server role. Given the level of permissions that provides, that’s not going to happen. However, our stored procedures will all be short so it should not be a major issue.

Creating Triggers Expand the folder for the table to which you want to apply the trigger. Right click on the Triggers folder and select New Trigger. Type in trigger code. NOTE: There are triggers on the student (probation) and registration (overload trigger) tables in the university database. You can view and copy the code