Parametre og variable i T-SQL 1.Parametre (input) 2.Parametre (output) 3.Variable.

Slides:



Advertisements
Similar presentations
آموزش SQL Server 2005.
Advertisements

Student Data Score First Name Last Name ID GPA DOB Phone... How to store student data in our programs? 1.
String in C++. String Series of characters enclosed in double quotes.“Philadelphia University” String can be array of characters ends with null character.
Stored procedures Procedural programming in Microsoft SQL Server 1Stored procedures.
Advanced SQL: Stored Procedures Instructor: Mohamed Eltabakh 1.
Applications of Discount & Markup Example 1: Sam’s Electronics has a movie camera on sale for $560. The original price was $800. Determine the percent.
Deeper Skill Set Certification Requirement Broader Skill Set Recertification Relevance Rigor.
2-9 Percents.
2015 International TechNet Wiki Summit 2015 Saeid Hasani Structured Error Handling Mechanism in SQL Server 2012 & 2014.
1 SQL/PSM Procedures Stored in the Database General-Purpose Programming.
IMS 4212: Application Architecture and Intro to Stored Procedures 1 Dr. Lawrence West, Management Dept., University of Central Florida
UNIT TESTING FOR SQL Prepared for SUGSA CodeLabs Alain King Paul Johnson.
Selene Bainum RiteTech LLC.  Doing ColdFusion & SQL development for more than 1/3 of my lifetime  Chief RiteTech  RiteTech is my company.
Dinamic SQL & Cursor. Why Dinamic SQL ? Sometimes there is a need to dynamically create a SQL statement on the fly and then run that command. This can.
Dexterity | CONFIDENTIAL 2009 MRO | Analytics | Insights 1 Stored Procedures.
Module 8: Implementing Stored Procedures. Introducing Stored Procedures Creating, Modifying, Dropping, and Executing Stored Procedures Using Parameters.
Module 9 Designing and Implementing Stored Procedures.
(with Microsoft SQL Server) Svetlin Nakov Telerik Corporation
PL/SQL vs. Transact-SQL. Transact-SQL Central to the use of Microsoft® SQL Server™. All applications that communicate with SQL Server do so by sending.
SELECT e.NationalIDNumber, p.FirstName,p.LastName, City FROM HumanResources.Employee e INNER JOIN Person.Person p on p.BusinessEntityID = e.BusinessEntityID.
Learning about Using Inverse Operations for finding the original price after a percentage increase or decrease.
SQL Server. اسکریپت درج مقدار در جدول USE Accounting; int; INSERT INTO Orders (CustomerNo,OrderDate, EmployeeID) VALUES (gETDATE,1); SELECT.
SQL Server 2012 Session: 1 Session: 10 Using Views, Stored Procedures, and Querying Metadata Data Management Using Microsoft SQL Server.
10 | Programming with Transact-SQL Graeme Malcolm | Senior Content Developer, Microsoft Geoff Allix | Principal Technologist, Content Master.
Ms. Reham Alhaweal Practice 3 Ms. Reham Alhaweal
SQL Server User Defined Functions. CREATE FUNCTION [ schema_name. ] function_name ( [ [ AS ][ type_schema_name. ] parameter_data_type.
Slide 1 of 19Session 13 Ver. 1.0 Querying and Managing Data Using SQL Server 2005 In this session, you will learn to: Implement stored procedures Implement.
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
Ch 5. Introducing More Database Objects. Database Objects Table (ch2) View (ch3) Stored Procedure Trigger Function User-defined types.
Ch 3. Working with Tables and Views. Data type Specify type of data to be entered into a column (text, number, datetime, etc) Unicode (National) Datatypes.
AND Gate Inputs Output Input A (Switch) Input B (Switch) Output Y (Lamp) 0 (Open) 0 (OFF) A B Lamp.
1 Indexes ► Sort data logically to improve the speed of searching and sorting operations. ► Provide rapid retrieval of specified rows from the table without.
Course 2778A Module 1: Getting Started with Databases and Transact-SQL in SQL Server 2008 Presentation: 60 minutes Lab: 60 minutes Module 1: Getting Started.
Module 9: Using Advanced Techniques. Considerations for Querying Data Working with Data Types Cursors and Set-Based Queries Dynamic SQL Maintaining Query.
Module 2: Querying and Filtering Data. Using the SELECT Statement Filtering Data Working with NULL Values Formatting Result Sets Performance Considerations.
Module 8: Using Programming Objects for Data Retrieval.
Module 6: Modifying Data in Tables. Inserting Data into Tables Deleting Data from Tables Updating Data in Tables Overview of Transactions.
1 Stored Procedure, Function and Trigger. 2Objectives 1. Database Programming 2. Stored Procedure 3. Function 4. Trigger.
Slide 1 of 32ASH-Training Querying and Managing Data Using SQL Server 2014 By: Segla In this session, you will learn to: Query data by using joins Query.
SQLSaturday Paris 2015 Plans d’execution Optimisations.
 MySQL  DDL ◦ Create ◦ Alter  DML ◦ Insert ◦ Select ◦ Update ◦ Delete  DDL(again) ◦ Drop ◦ Truncate.
Module 3: Grouping and Summarizing Data. Summarizing Data by Using Aggregate Functions Summarizing Grouped Data Ranking Grouped Data Creating Crosstab.
Module 9: Implementing Functions. Overview Creating and Using Functions Working with Functions Controlling Execution Context.
Creating Functions This presentation was prepared by Professor Steve Ross, with the advice of other MIS Faculty, for use in MIS Classes at Western Washington.
T-SQL Scripts Advanced Database Dr. AlaaEddin Almabhouh.
1 c6212 Advanced Database and Client Server MS SQL Server 2000 Stored Procedures and Parameters What ? Why ? How ?
Transact SQL (T-SQL) Creating Stored Procedures, Functions and Triggers SoftUni Team Technical Trainers Software University
Querying with Transact-SQL
10 | Programming with Transact-SQL
Chapter Name By Adrienne Watt
All Powder Board and Ski
Objectives Describe an overview of Transact-SQL programming
STORED PROCEDURES AND FUNCTION (9.6.1)
Overview Implementing Triggers Implementing XML Schemas.
Stored Procedures
Strings A collection of characters taken as a set:
SQL Server Stored Procedures.
There’s a particular style to it…
“Magic numbers”, local variable and performance
මොඩියුල විශ්ලේෂණය Stored Procedure හඳුන්වා දීම.
There’s a particular style to it…
SQL Server Sp_refreshview for all views in a Database
COP 2700 – Data Structures (SQL)
Assignment: SQL #2 Putting Information into a Database
There’s a particular style to it…
View ایحاد وتغییر Viewایجاد ایندکس روی
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
SQL AUTO INCREMENT Field
Title Firstname Lastname 1, Firstname Lastname 2 and Firstname Lastname 3 1 Affiliations. Dummy text, dummy text, dummy text 2 Affiliations. Dummy text,
Presentation transcript:

Parametre og variable i T-SQL 1.Parametre (input) 2.Parametre (output) 3.Variable

Parametre (Input) 1.USE AdventureWorks; 2.GO 3.IF OBJECT_ID ( 'HumanResources.uspGetEmployees', 'P' ) IS NOT NULL 4.DROP PROCEDURE HumanResources.uspGetEmployees; 5.GO 6.CREATE PROCEDURE HumanResources.uspGetEmployees nvarchar(50), nvarchar(50) 9.AS 10.SET NOCOUNT ON; 11.SELECT FirstName, LastName, JobTitle, Department 12.FROM HumanResources.vEmployeeDepartment 13.WHERE FirstName AND LastName 14.GO 1.EXECUTE HumanResources.uspGetEmployees N'Ackerman', N'Pilar'; Or 3.EXEC = = N'Pilar'; 4.GO 5.-- Or 6.EXECUTE = = N'Ackerman'; 7.GO

Parametre (Output) USE AdventureWorks; GO IF OBJECT_ID ( 'Production.uspGetList', 'P' ) IS NOT NULL DROP PROCEDURE Production.uspGetList; GO CREATE PROCEDURE money money OUT AS SET NOCOUNT ON; SELECT p.[Name] AS Product, p.ListPrice AS 'List Price' FROM Production.Product AS p JOIN Production.ProductSubcategory AS s ON p.ProductSubcategoryID = s.ProductSubcategoryID WHERE s.[Name] AND p.ListPrice -- Populate the output = (SELECT MAX(p.ListPrice) FROM Production.Product AS p JOIN Production.ProductSubcategory AS s ON p.ProductSubcategoryID = s.ProductSubcategoryID WHERE s.[Name] AND p.ListPrice -- Populate the output GO

Variable 1.USE AdventureWorks; 2.GO SET NOCOUNT ON; 3.GO money; = N'North America'; = ; 6.SET NOCOUNT OFF; 7.SELECT FirstName, LastName, SalesYTD 8.FROM Sales.vSalesPerson 9.WHERE TerritoryGroup and SalesYTD 1.USE AdventureWorks; 2.GO varchar(30); 3./* Also allowed: varchar(30) = 'Man%'; 5.*/ = 'Man%'; 7.SELECT LastName, FirstName, Phone 8.FROM Person.Contact WHERE LastName