|
Sybase User defined SQL functions
|
|
11-10-2008, 11:19 PM
Post: #1
|
|||
|
|||
|
Sybase User defined SQL functions
You are not logged in or registered. Please login or register to use the full functionality of this SYBASETEAM.COM Website... Sybase User defined SQL functionsIntroductionUser defined SQL functions are a new feature in ASE 15.0.2. This document shows you how to work with them. This example demonstrates how to return a part of a string filled with an ip-address. The returned value should of the datatype tinyint. So for ip-address 192.138.151.104 and part 3 the returned value should be 151. Create the functionGoes like this: create function get_ip_part Execute the functionYou can execute the function in the same manner as a Sybase supplied function: select get_ip_part("192.138.151.104",3)
However, in the pre-release of 15.0.2 you need to specify dbo in front of the name: select dbo.get_ip_part("192.138.151.104",3)
When you do not do so, you will get this error: Msg 2847, Level 18, State 1: Cross database execution is possible, as in my_database.dbo.get_ip_part Drop a functionCan be done with the drop statement: drop function get_ip_part MiscellaneousThe basic definition of user defined SQL function is stored in sysobjects. The value of column type will be "SF". Internally, within ASE, user defined SQL functions behave the same as stored procedures. This means that there is a query plan for them and you can access tables in user defined SQL functions. Thanks, ZA |
|||
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads... | |||||
| Thread: | Author | Replies: | Views: | Last Post | |
| Java and SQL user-defined functions in Sybase ASE | crazYoga | 0 | 308 |
02-02-2010 02:26 AM Last Post: crazYoga |
|
| Getting Row Counts in User Tables in Sybase ASE | Nagendra | 0 | 644 |
11-28-2009 07:25 PM Last Post: Nagendra |
|
| ltrim and rtrim functions in sybase | Joshi | 0 | 597 |
09-09-2009 01:51 AM Last Post: Joshi |
|
| sybase string functions with examples | john | 0 | 778 |
07-07-2009 02:30 AM Last Post: john |
|
| TRANSACT-SQL Wiki and User Guide Web Link | sybaseteam | 0 | 350 |
06-04-2008 10:35 PM Last Post: sybaseteam |
|


Chat Support
Search
Disclaimer & Rules
Help


