SQL Server
  Home arrow SQL Server arrow Creating User Defined Functions In SQL Ser...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
SQL SERVER

Creating User Defined Functions In SQL Server 2000
By: Mitchell Harper
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 107
    2002-01-24

    Table of Contents:
  • Creating User Defined Functions In SQL Server 2000
  • What is a user-defined function?
  • Creating a scalar UDF
  • Creating an inline-table valued UDF
  • Creating a multi-statement table valued UDF
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating User Defined Functions In SQL Server 2000


    (Page 1 of 6 )

    Microsoft SQL Server 2000 allows us to create our own functions and call them through code. These functions are known as UDF's (User Defined Functions). In this article Mitchell's going to teach us how to create three different types of UDF's and how to work with them through batches of SQL code.From a programmer's perspective, functions allow us to break up our code into easily re-useable chunks of inter-related logic, which we can reference by name, pass parameters to, and receive return values from. It is often handy to create functions to work with data in a database. Before the release of Microsoft SQL Server 2000, however, this was only possible using stored procedures.

    Along with tightly integrated support for XML, several new data types and advanced data import/export functionality, Microsoft SQL Server 2000 also allows us to create our own functions and call them through code. These functions are known as UDF's (User Defined Functions).

    In this article we're going to take a look at creating our first UDF. We will also look at the three different types of UDF's and how to work with UDF's through batches of SQL code.

    To implement the examples shown in this article you should have SQL Server 2000 installed on a Windows 2000 machine and have access to this machine as an administrator. You can download a free 120-day evaluation version of Microsoft SQL Server here.

    More SQL Server Articles
    More By Mitchell Harper


     

    SQL SERVER ARTICLES

    - Executing SQL Server Stored Procedure from P...
    - How to Search for Date and Time Values Using...
    - Replication: SQL Server 2000 - Part 2
    - Replication: SQL Server 2000 - Part 1
    - SQL Sever: Storing Code in Binary or Text Fi...
    - Execute SQL on Multiple Tables/Columns - New...
    - How to Connect to a SQL Server from Visual F...
    - SQL Server Hardware Tuning and Performance M...
    - Primary Key on Multiple Tables – New RDBMS C...
    - Migrating from Sybase to SQL Server
    - What's Best for DBAs? GUI or T-SQL Comma...
    - How to Perform a SQL Server Performance Audit
    - An Introduction To The Bulk Copy Utility
    - SQL Server Stored Procedures 101
    - Building Your First SQL Server 2000 Database






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT