RoguePoet01
Programmer
Hi,
I'm stepping up to VB.net and just read an article about using stored SQL functions.
Though I use SQL for my database, I've never had the need to write a stored SQL function before, but this sounds like a good idea.
Would anybody have the time to show me a simple function that inserts three fields into a table, and returns the "RecIndex" which is the primary/identity key.
This is some pseudocode to help fill in the blanks:
Table "ClubMember"
RecIndex (primary key)
Name (char 35)
Age (numeric)
BirthDate (datetime)
CREATE FUNCTION AddMember
(@NAME CHAR(35), @AGE NUMERIC, @BIRTHDATE DATETIME)
RETURNS RI
AS
BEGIN
INSERT INTO CLUBMEMBER(Name, Age, Birthdate)
VALUES ('Albert', '33', '7/17/1977')
RETURN RI
END
I'm stepping up to VB.net and just read an article about using stored SQL functions.
Though I use SQL for my database, I've never had the need to write a stored SQL function before, but this sounds like a good idea.
Would anybody have the time to show me a simple function that inserts three fields into a table, and returns the "RecIndex" which is the primary/identity key.
This is some pseudocode to help fill in the blanks:
Table "ClubMember"
RecIndex (primary key)
Name (char 35)
Age (numeric)
BirthDate (datetime)
CREATE FUNCTION AddMember
(@NAME CHAR(35), @AGE NUMERIC, @BIRTHDATE DATETIME)
RETURNS RI
AS
BEGIN
INSERT INTO CLUBMEMBER(Name, Age, Birthdate)
VALUES ('Albert', '33', '7/17/1977')
RETURN RI
END