`
tanglei198577
  • 浏览: 60274 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

Some examples of procudure of Sqlserver 2000

阅读更多

I have read SQL server 2000 stored procedures HandBook,just do some easy examples of it.here is the code:

create procedure Example_05 @ValIn bigint,@ValOut bigint output
as
begin
  if @ValIn > 20
  begin
     print 'Invalid starting point should be <=20'
     return -99
  end
  
  declare @WorkValIn bigint, @WorkValOut bigint
  
  if @ValIn != 1
     begin
       set @WorkValIn = @ValIn -1
       print @@NESTLEVEL
       exec Example_05 @WorkValIn,@WorkValOut output
       set @ValOut = @WorkValOut * @ValIn
     end
  else
    set @ValOut = 1
end

declare @FactIn int,@FactOut int
set @FactIn =6
exec Example_05 @FactIn,@FactOut output
print 'Factorial of ' + convert(varchar(3),@FactIn) +' is '+convert(varchar(20),@FactOut)

 

create procedure Example_03
as
begin
  declare @var1 int,@var2 int
  set  @var1 = 1
  set  @var2 = 1
  while @var1 <10
    begin
      if @var2>20
         break
      set @var1 = @var1+1
      set @var2 = @var2+@var2
    end
   print 'var1='+convert(char(5),@var1) +'and var2='+convert(char(5),@var2)
end

 

create procedure example_02
as
begin
  select product_id,mfr_id,qty_on_hand,
  case  qty_on_hand
  when 0 then 'No qty'
  when (select max(qty_on_hand) from [products]) then 'top qty'
  else 'aver qty'
  end as disc
  from [products]
end

 I will learn it more :)

1
1
分享到:
评论

相关推荐

    Data Science with SQL Server

    Although we do not cover the totality of SQL Server in this book, references are provided and some concepts are explained in case you are not familiar with SQL Server, as is often the case with data ...

    Professional Microsoft SQL Server 2012 Administration

    and analysis services Includes real-world case examples and best practices from Microsoft insiders If you're a database administrator eager to get started with the newest version of SQL Server,...

    Sql Server Bible 2000 With Examples

    《SQL Server Bible 2000 With Examples》是一本针对微软SQL Server 2000深入解析的权威指南。这本书全面覆盖了SQL Server 2000的各种特性和功能,旨在帮助读者掌握数据库管理和开发的核心技能。以下是该书可能涵盖...

    SQL Server 2016 Developer's Guide

    Some understanding of the basic database concepts and Transact-SQL language is assumed. What You Will Learn Explore the new development features introduced in SQL Server 2016 Identify opportunities...

    Inside Microsoft SQL Server 2000

    1. The Evolution of Microsoft SQL Server: 1989 to 2000 [加入我的離線書架] . SQL Server: The Early Years . Ron's Story . Kalen's Story . Microsoft SQL Server Ships . Development Roles Evolve . OS...

    SOME EXAMPLES OF THE USE OF IEC 60870-5-101 PROTOCOL STANDARD

    SOME EXAMPLES OF THE USE OF IEC 60870-5-101 PROTOCOL STANDARD

    Beginning T-SQL with Microsoft SQL Server 2005 and 2008

    And if you know SQL Server 2005, you’ll learn about some exciting new capabilities in SQL Server 2008. Information Technology professionals in many different roles use T-SQL. Our goal is to provide...

    Beginning SQL Server for Developers(Apress,4ed,2014).

    Within the book, there are plenty of examples of tasks that developers routinely perform. You'll learn to create tables and indexes, and be introduced to best practices for securing your valuable ...

    jsp+SQL Server 2000人才招聘网站

    【JSP+SQL Server 2000 人才招聘网站】是一个基于JavaServer Pages(JSP)技术构建的,利用SQL Server 2000作为后台数据库的招聘平台。在这个项目中,JSP用于创建动态网页,而SQL Server 2000则负责存储和管理网站的...

    Microsoft SQL Server 2008 - T-SQL Querying March 2009

    defi nition, design, and implementation of the Query Processing engine of SQL Server for over a decade, and I deeply respect his insight. They make an outstanding team of guides who can help you ...

    Microsoft SQL Server 2014 Business Intelligence Development(PACKT,2014)

    Take advantage of the real power ... The book is packed with real-world examples that will give you a good understanding of the BI and DW components of SQL Server 2014, Excel 2013, and SharePoint 2013.

    Professional SQL Server 2005 Programming

    07年新书 884页 Summary: Professional SQL Server 2005 Programming shows experienced developers how to master the substantially revamped feature set of the latest release of Microsoft SQL Server....

    Microsoft SQL Server 2016: A Beginner’s Guide, 6th Edition

    Filled with new real-world examples and hands-on exercises, Microsoft SQL Server 2016: A Beginner’s Guide, Sixth Edition 版本, starts by explaining fundamental relational database system concepts....

    Professional Microsoft SQL Server 2008 Programming

    Review the new features of SQL Server that will be of interest to you as an experienced developer and move on to more detailed, practical code examples. Learn how to write complex queries, build ...

Global site tag (gtag.js) - Google Analytics