•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 363,560 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,928 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 5204 | Replies: 2
![]() |
•
•
Join Date: Apr 2005
Location: Milwaukee, WI
Posts: 156
Reputation:
Rep Power: 4
Solved Threads: 3
It's pretty easy.
CREATE FUNCTION MyFunction(@variableOne datatype)
RETURNS datatype
AS
BEGIN
-- put function logic here
RETURN @variable
END
Then to call the function, you would use it in any SQL statement. For example
SELECT FIELD1, MyFunction(FIELD2) as ALIAS
FROM SOMETABLE;
Hope this helps
Andy
CREATE FUNCTION MyFunction(@variableOne datatype)
RETURNS datatype
AS
BEGIN
-- put function logic here
RETURN @variable
END
Then to call the function, you would use it in any SQL statement. For example
SELECT FIELD1, MyFunction(FIELD2) as ALIAS
FROM SOMETABLE;
Hope this helps
Andy
Nobody believes the official spokesman, but everybody trusts an unidentified source.
-- Please do not PM me with questions about a thread. If you respond to a thread, then everyone can benefit.
-- Please do not PM me with questions about a thread. If you respond to a thread, then everyone can benefit.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
- Can we call a User defined Function using Linked Servers ? (MS SQL)
- User-defined functions (C++)
- User-Defined Function - part 2 (C++)
- Passing a matrix from main function to user defined function. (C++)
- error in user defined string class (C++)
- using(STL)function object (bind2nd) with a user defined function object (C++)
Other Threads in the MS SQL Forum
- Previous Thread: Getting current value in Select Statement
- Next Thread: Do uncompression of disk drives affects my Database?


Linear Mode