Site sponsored by: Idera The gold standard of SQL Server performance monitoring & diagnostics.
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Performance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

System Data Collection Reports
Recover Data Using Database Snapshots
Analyze and Fix Index Fragmentation in SQL Server 2008
Powerful Geographical Visualisations made easy with SQL 2008 Spatial (Part 2) ...

More     
 
Latest FAQ's

How to alter a User Defined Data Type?
How to unzip a File in SSIS?
How to view previous query plans?
ALTER TABLE SWITCH statement failed because the object '%.*ls' is not ...

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

articles >> developer >> An Introduction to SQL Server Scalar UDFs ...

An Introduction to SQL Server Scalar UDFs

By : Navneeth Diwaker Naik
May 17, 2004

Page 4 / 4

Now that we have encrypted the function, there is no way we can decrypt it again. So be careful while you encrypt a function. Review or execute the following script and note the output:

SELECT    

        sysobjects.name AS [Function Name],

        syscomments.text AS [Function Definition]

FROM

        sysobjects INNER JOIN

        syscomments ON sysobjects.id = syscomments.id

WHERE

        (sysobjects.xtype = 'FN')

Output:

Function Name  Function Definition

--------------------------------------------------

fnSchemaTest    Create function fnSchemaTest ….

fnEncrypTest     ????????????????????????????…

fngetEmail         Create function fngetEmail  (…

As you can see, you cannot view the definition of fnEncrypTest, since it is encrypted.

I personally feel that we should use scalar UDFs under the conditions where we need the single output with 0 or more inputs. Views cannot perform this operation, since they cannot accept input parameters. While stored procedure can in such situations, the main disadvantage of a stored procedure is that the output of the stored procedure cannot be used in SELECT statements, whereas the output of scalar user-defined functions can be used in SELECT statements. Performance-wise, SPs and scalar UDFs are same because both are compiled and optimized in the same way. An important point I would like to highlight is that UDFs are not in SQL 92 standards, while they are included in SQL 99 standards.

Published with the explicit written permission of the author. Copyright 2004.


<< Prev Page         








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved