473,403 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Custom Row Functions: Access vs. SQL Server

TC
I have an Access database application with a lot of custom row
functions written in VBA. In other words, a lot of queries contain
calculated fields which use functions defined in the modules.

I am now thinking about upgrading the database from Access to SQL
Server. If I do, how can I implement the custom row functions? Is
Visual Basic integrated with SQL Server just as it is with Access? Or
does T-SQL in SQL Server offer the functionality VBA gives me in
Access? Or perhaps there is no way to do custom row functions in the
back-end, and they have to be implemented in the front-end?

Can anyone explain to me how it works?
-TC

Nov 16 '05 #1
22 3758
On 16 Nov 2005 08:05:23 -0800, "TC" <go*********@yahoo.com> wrote:
I have an Access database application with a lot of custom row
functions written in VBA. In other words, a lot of queries contain
calculated fields which use functions defined in the modules.

I am now thinking about upgrading the database from Access to SQL
Server. If I do, how can I implement the custom row functions? Is
Visual Basic integrated with SQL Server just as it is with Access? Or
does T-SQL in SQL Server offer the functionality VBA gives me in
Access? Or perhaps there is no way to do custom row functions in the
back-end, and they have to be implemented in the front-end?

Can anyone explain to me how it works?
-TC


Custom functions can be used in SQL Server 2000 and above queries, but they
must be written in T-SQL and contained on the server. Furthermore, the
performance of these functions is absolutely dismal. You can slow a query
down by a factor of 10,000 by putting a few simple function calls in it (note
that tabluar functions don't have this performance problem).

Fortunately, this just isn't a problem with most Access/SQL Server
applications because it turns out the functions are usually used at a point in
the query where Access/JET can apply it to the results coming back from the
server. If I do a query of a linked table, and I format a field as a string
using Format(), Access first queries the fields it needs from the back-end,
then applies the Format function locally as the rows are received.

The trouble comes in when you use Access functions somewhere that they prevent
Access/JET from being able to delegate processing to the back-end, such as
when the function is used in a WHERE clause or inside and aggregate function
such as SUM(Round([Foo])). You just need to be aware of these cases, and
avoid them.
Nov 16 '05 #2
IMO T-SQL in SQL Server offers the functionality VBA gives in Access.
But, it might be helpful if we are sure we are talking about the same
thing. If you could post one of the queries that calls perhaps two of
the VBA functions, and the code of the functions, then we might see how
this could be done as T-SQL only.

(I have been wondering whether VBA is redundant when one uses MS-SQL
[that is a application without modules might be efficient] but that is
another story.)

Nov 16 '05 #3
TC
Steve,

Thank you for the reply.

In fact, I expressed my question badly -- I'm really interested in
moving the functions to the back-end, so your comments on T-SQL are
most relevant to me. Is T-SQL really that slow? Suppose I choose Oracle
instead; does PL-SQL have the required capabilities, and is it faster
than T-SQL?

Also, what is a "tabular function"?
-TC

Nov 16 '05 #4
TC
Lyle,

Thank you for the answer. After reflection, I realize I asked the wrong
question. What I really want to know is whether SQL Server allows me to
implement, in the back-end, row functions as powerful as those Access
allows me to implement, in the front-end, using VBA. In other words,
the issue you mentioned in your footnote is really the question I meant
to raise.

I can't provide any real-code examples, but here is an illustrative
sample:

Query:
SELECT ContactID, FirstName, LastName, FullName(FirstName, LastName) AS
FullName
FROM Contact;

Module:
Function FullName(FirstName, LastName)
If IsNull(FirstName) Then
If IsNull(LastName) Then
FullName = Null
Else
FullName = LastName
End If
Else
If IsNull(LastName) Then
FullName = FirstName
Else
FullName = FirstName & " " & LastName
End If
End If
End Function

This is really a trivial example. A realistic example would use much
more complicated program logic. In order to implement all the functions
in my application, I need a procedural programming language with
variables, arrays, looping, branching, error-handling, etc. Does T-SQL
qualify?

I should mention that one thing I love about Access is the way it lets
me organize the program logic. I create one module for every entity in
my ERD diagram. In that module, I have a section called "Row
Functions". I can be confident that the logic required for every row
function will be implemented in a modular format in that section (as
opposed to somewhere among the SQL of my queries). This is an
under-appreciated benefit to MS Access which I hope has some equivalent
in SQL Server.

By the way, what do you say to Steve's claim that T-SQL is a
performance killer?

Also, which term is current, "T-SQL" or "MS-SQL"?
-TC

Nov 16 '05 #5

TC wrote:
Lyle,

Thank you for the answer. After reflection, I realize I asked the wrong
question. What I really want to know is whether SQL Server allows me to
implement, in the back-end, row functions as powerful as those Access
allows me to implement, in the front-end, using VBA. In other words,
the issue you mentioned in your footnote is really the question I meant
to raise.

I can't provide any real-code examples, but here is an illustrative
sample:

Query:
SELECT ContactID, FirstName, LastName, FullName(FirstName, LastName) AS
FullName
FROM Contact;
CREATE PROCEDURE QueryTemp
AS
SELECT DISTINCT(dbo.FullName(Supplier,Article)) FROM Fabrics
RETURN

(I had to munge a fabrics table to test this)
Module:
Function FullName(FirstName, LastName)
If IsNull(FirstName) Then
If IsNull(LastName) Then
FullName = Null
Else
FullName = LastName
End If
Else
If IsNull(LastName) Then
FullName = FirstName
Else
FullName = FirstName & " " & LastName
End If
End If
End Function
CREATE FUNCTION dbo.FullName
(
@FirstName varchar(255),
@LastName varchar(255)
)
RETURNS varchar(255)
AS
BEGIN
DECLARE @FullName varchar(255)
SET @FullName = LTRIM(RTRIM(ISNULL(@FirstName,'') + ' ' +
ISNULL(@LastName,'')))
IF LEN(@FullName) = 0
SET @FullName = NULL
RETURN @FullName
END

(I don't know if all the NULL testing is required; it depends I suppose
on your requirements)
This is really a trivial example. A realistic example would use much
more complicated program logic. In order to implement all the functions
in my application, I need a procedural programming language with
variables, arrays, looping, branching, error-handling, etc. Does T-SQL
qualify?
I think so; it does not have array but it does have cursors ("sort of"
recordsets)

I should mention that one thing I love about Access is the way it lets
me organize the program logic. I create one module for every entity in
my ERD diagram. In that module, I have a section called "Row
Functions". I can be confident that the logic required for every row
function will be implemented in a modular format in that section (as
opposed to somewhere among the SQL of my queries). This is an
under-appreciated benefit to MS Access which I hope has some equivalent
in SQL Server.
Yes, I can understand that.
By the way, what do you say to Steve's claim that T-SQL is a
performance killer?
I'm unaware that it's a performance killer and have not found it to be
so, but typically my applications are calculation intensive rather than
data extensive. Perhaps, Steve will expand on that.
Also, which term is current, "T-SQL" or "MS-SQL"?


T-SQL -> Transact SQL ... the "programming" language or script of
MS-SQL server.

******
As an example this is a Procedure on which I am currently working; I
have done this previously in VBA, VB (compiled to COM) and
ASP/Javascript. (Lest anyone want to point out that its incomplete,
please note the "on which I am currently working").
ALTER PROCEDURE dbo.CreateTimeTable
@SchoolID int = 0
AS
/* delete current time table entrie dor school */
DELETE Timetable WHERE Teacher IN
(SELECT TeacherID FROM Teachers WHERE SchoolID = @SchoolId)

/* Declare Variables */
Declare @DaysPerCycle int, @PeriodsPerDay int, @PeriodsPerCycle int
Declare @Class int, @Subject int, @Teacher int,
@ClassSubjectTeacherPeriods int
Declare @SumClassTeacherPeriods tinyint,
@SumClassSubjectTeacherPeriods tinyint
Declare @ClassTeacherOrdinal tinyint, @ClassSubjectTeacherOrdinal
tinyint
Declare @Required varchar(255), @Forbidden varchar(255),
@MaximumConcurrent tinyint

/* get Parameters of Cycle */
SELECT @DaysPerCycle=DaysPerCycle, @PeriodsPerDay=PeriodsPerDay
FROM Schools WHERE SchoolID = @SchoolID
SET @PeriodsPerCycle = @DaysPerCycle * @PeriodsPerDay

/* get Assignments Cursor */
DECLARE AssignmentsCursor CURSOR
FOR
SELECT a.ClassID, a.SubjectID, a.TeacherID, a.Periods,
a2.SumClassSubjectTeacherPeriods, a4.SumClassTeacherPeriods,
a.Manual, t.UnavailablePeriods, s.MaximumConcurrentPeriods
FROM Assignments a
JOIN
Teachers t
ON a.TeacherID=t.TeacherID
JOIN
Subjects s
ON a.SubjectID=s.SubjectID
LEFT JOIN
(SELECT a1.ClassID, a1.SubjectID, a1.TeacherID, Sum(a1.Periods) AS
SumClassSubjectTeacherPeriods FROM Assignments a1
JOIN
Teachers t
ON a1.TeacherID=t.TeacherID
WHERE t.SchoolID = @SchoolID
GROUP BY a1.ClassID, a1.SubjectID, a1.TeacherID) a2
ON a.ClassID = a2.ClassID AND a.SubjectID = a2.SubjectID AND
a.TeacherID = a2.TeacherID
LEFT JOIN
(SELECT a3.ClassID, a3.TeacherID, Sum(a3.Periods) AS
SumClassTeacherPeriods FROM Assignments a3
JOIN
Teachers t
ON a3.TeacherID=t.TeacherID
WHERE t.SchoolID = @SchoolID
GROUP BY a3.ClassID, a3.TeacherID) a4
ON a.ClassID = a4.ClassID AND a.TeacherID = a4.TeacherID
WHERE t.SchoolID = @SchoolID
ORDER BY a4.SumClassTeacherPeriods desc, a.ClassID, a.TeacherID,
a.SubjectID

/* open AssignmentsCursor */
OPEN AssignmentsCursor

/* Get first record from Assignments Cursor */
FETCH NEXT FROM AssignmentsCursor
INTO @Class, @Subject, @Teacher, @ClassSubjectTeacherPeriods,
@SumClassSubjectTeacherPeriods, @SumClassTeacherPeriods,
@Required, @Forbidden, @MaximumConcurrent

/* Loop through Assignments Cursor */
WHILE @@FETCH_STATUS != -1

BEGIN

/* Insert number of periods required */
/* by looping while decremented @ClassSubjectTeacherPeriods > 0 */
WHILE @ClassSubjectTeacherPeriods > 0

BEGIN

IF ISNULL(@ClassTeacherOrdinal,0) = 0
SET @ClassTeacherOrdinal = @SumClassTeacherPeriods

/* do the insert */
INSERT INTO Timetable
(Class, Subject, Teacher,
SumClassSubjectTeacherPeriods, SumClassTeacherPeriods,
ClassSubjectTeacherOrdinal, ClassTeacherOrdinal,
Required, Forbidden, MaximumConcurrent)
VALUES
(@Class, @Subject, @Teacher,
@SumClassSubjectTeacherPeriods, @SumClassTeacherPeriods,
@ClassSubjectTeacherPeriods, @ClassTeacherOrdinal,
@Required, @Forbidden, @MaximumConcurrent)

/* decrement @ClassSubjectTeacherPeriods */
SET @ClassSubjectTeacherPeriods = @ClassSubjectTeacherPeriods - 1
/* decrement @ClassTeacherOrdinal */
SET @ClassTeacherOrdinal = @ClassTeacherOrdinal - 1

END

FETCH NEXT FROM AssignmentsCursor
INTO @Class, @Subject, @Teacher, @ClassSubjectTeacherPeriods,
@SumClassSubjectTeacherPeriods, @SumClassTeacherPeriods,
@Required, @Forbidden, @MaximumConcurrent

END

CLOSE AssignmentsCursor
DEALLOCATE AssignmentsCursor

RETURN

Nov 16 '05 #6
In message <11*********************@f14g2000cwb.googlegroups. com>, TC
<go*********@yahoo.com> writes
This is really a trivial example. A realistic example would use much
more complicated program logic. In order to implement all the functions
in my application, I need a procedural programming language with
variables, arrays, looping, branching, error-handling, etc. Does T-SQL
qualify?


Possibly not. But if you use SQL Server 2005 you should be able to code
the functions you require in any of the .NET languages and call them
from T-SQL.

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 16 '05 #7
Bernard Peek wrote:
But if you use SQL Server 2005 you should be able to code
the functions you require in any of the .NET languages and call them
from T-SQL.


Perhaps, you could expand on this with references to the appropriate
Micorsoft articles?

Nov 17 '05 #8
Bernard Peek wrote:
But if you use SQL Server 2005 you should be able to code
the functions you require in any of the .NET languages and call them
from T-SQL.


Perhaps, you could expand on this with references to the appropriate
Microsoft articles?

Nov 17 '05 #9
rkc
lylefair wrote:
Bernard Peek wrote:
But if you use SQL Server 2005 you should be able to code
the functions you require in any of the .NET languages and call them
from T-SQL.

Perhaps, you could expand on this with references to the appropriate
Micorsoft articles?


Here's a start.

http://www.microsoft.com/sql/prodinf...erver2005.mspx

Nov 17 '05 #10
rkc wrote:
Here's a start.

http://www.microsoft.com/sql/prodinf...erver2005.mspx


Cool! So this means the end of Access, JET, DAO, VBA (and civlization)
as we know them?

Nov 17 '05 #11
rkc
lylefair wrote:
rkc wrote:

Here's a start.

http://www.microsoft.com/sql/prodinf...erver2005.mspx

Cool! So this means the end of Access, JET, DAO, VBA (and civlization)
as we know them?


I'm pretty sure civlization is fucked regardless.
Nov 17 '05 #12
On 16 Nov 2005 10:31:56 -0800, "TC" <go*********@yahoo.com> wrote:
Steve,

Thank you for the reply.

In fact, I expressed my question badly -- I'm really interested in
moving the functions to the back-end, so your comments on T-SQL are
most relevant to me. Is T-SQL really that slow? Suppose I choose Oracle
T-SQL is not slow in general, however scalar functions really are that slow.
It basically means you don't use scalar functions much, but other than that,
MS SQL Server preforms quite well.
instead; does PL-SQL have the required capabilities, and is it faster
than T-SQL?
PL-SQL does have the capabilities, and its scalar function performance is
great, but Access works slightly better with the MS SQL Server back-end, and
you have to make sure your ODBC settings are just right, for PostgreSQL to
work correctly with Access on the front-end.
Also, what is a "tabular function"?


That is a function that returns rows - essentially like an Access select query
that can take parameters.
Nov 17 '05 #13
Steve Jorgensen <no****@nospam.nospam> wrote in
news:oa********************************@4ax.com:
On 16 Nov 2005 08:05:23 -0800, "TC" <go*********@yahoo.com> wrote:
I have an Access database application with a lot of custom row
functions written in VBA. In other words, a lot of queries containcalculated fields which use functions defined in the modules.

I am now thinking about upgrading the database from Access to SQL
Server. If I do, how can I implement the custom row functions? Is
Visual Basic integrated with SQL Server just as it is with Access?Or does T-SQL in SQL Server offer the functionality VBA gives me
in Access? Or perhaps there is no way to do custom row functions
in the back-end, and they have to be implemented in the front- end?
Can anyone explain to me how it works?
Custom functions can be used in SQL Server 2000 and above

queries, but they must be written in T-SQL and contained on the server.
Er, doesn't that depend entirely on what the VBA functions/UDFs do
and how they are used? If, for instance, you are sorting or
filtering on a UDF, then you should port it to some T-SQL
equivalent, because otherwise, you're going to have a mess.

But if you're just calculating, where's the harm in leaving them in
VBA? Assuming that you are filitering the recordset based on
selections on some of the non-calculated columns, it should be
perfectly fast, as Jet will hand off the filtering part to the back
end, and then apply the functions only to the matching records that
are returned.
Furthermore, the performance of these functions is absolutely
dismal. You can slow a query down by a factor of 10,000 by
putting a few simple function calls in it (note that tabluar
functions don't have this performance problem).
It entirely depends on what the functions do, and how they are
used,
no?
Fortunately, this just isn't a problem with most Access/SQL Server applications because it turns out the functions are usually used
at a point in the query where Access/JET can apply it to the
results coming back from the server. If I do a query of a linked
table, and I format a field as a string using Format(), Access
first queries the fields it needs from the back-end, then applies
the Format function locally as the rows are received.
Oops. I should read the whole post before replying, I guess.
The trouble comes in when you use Access functions somewhere that
they prevent Access/JET from being able to delegate processing to
the back-end, such as when the function is used in a WHERE clause
or inside and aggregate function such as SUM(Round([Foo])). You
just need to be aware of these cases, and avoid them.


That may still be manageable if the number of records returned is
limited by some other criteria. It entirely depends on how you're
using the VBA function.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 17 '05 #14
On 16 Nov 2005 17:33:34 -0800, "lylefair" <ly***********@aim.com>
wrote:

It's cool that you can use any .Net language in your sprocs.
Performance-wise, I don't know where that leaves us. And even if I did
know, I would not be able to share that information (see Eula).
Personally I think we should not discard T-Sql just yet. If it can be
done set-based, procedural is always going to be slower.

-Tom.

rkc wrote:
Here's a start.

http://www.microsoft.com/sql/prodinf...erver2005.mspx


Cool! So this means the end of Access, JET, DAO, VBA (and civlization)
as we know them?


Nov 17 '05 #15
"lylefair" <ly***********@aim.com> wrote
Here's a start.
http://www.microsoft.com/sql/prodinf...erver2005.mspx
Cool! So this means the end of Access, JET, DAO, VBA (and civlization)
as we know them?


So Chicken Little _was_ correct?
Nov 17 '05 #16

TC wrote:
By the way, what do you say to Steve's claim that T-SQL is a
performance killer?


I was interested in this statement, never having noted any particular
slowness, but then again, never really having considered the issue, so,
having woken up I decided to do a little test as below:

Option Explicit

Private Declare Function GetTickCount Lib "kernel32" () As Long

Sub TestUDFFullNameforSpeed()
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Dim t As Single
Dim z As Long

Set c = New ADODB.Connection
c.Open CurrentProject.AccessConnection.ConnectionString &
";Password=Password"

t = GetTickCount
For z = 1 To 100
' SELECT DISTINCT(dbo.FullName(Supplier,Article)) FROM Fabrics
Set r = c.Execute("QueryTemp")
Next z
Debug.Print r.RecordCount, GetTickCount - t
' with the UDF
' returns 16 distinct records 100 times in 9.654 seconds

t = GetTickCount
For z = 1 To 100
' SELECT DISTINCT Supplier,Article FROM Fabrics
Set r = c.Execute("QueryTemp2")
Next z
Debug.Print r.RecordCount, GetTickCount - t
' without a UDF
' returns 16 distinct records 100 times in 9.604 seconds

' function call seems to require 0.00003125 seconds per record
' how does that compare with using a VBA function
' who knows?

' note second call of function resulted in FullName function being
FASTER
' 16 9485
' 16 9917

' server is in California
' workstation is in Ontario, Canada about 4000 km distant

' connection is Cable Modem - Internet

' Access Version is 2003
' ADO is 2.5

End Sub

As you can see I did not find that the UDF was slow; in fact it may
have had no appreciable slowdown at all [may even no slowdown at all].
When compared with other "time" issues like the speed of data over the
wire, what other tasks the server might be performing when you ask it
to call the function etc, I think I am not going to worry about it,
barring Steve coming up with something I have overlooked.

I would add that I have found CurrentProject.Connection to be amazingly
slow in some situations and I try never to use it except in trivial
situations. (That's why I have created a separate connection here In a
project I generally have a public function that returns an independent
connection; Access typically opens more connections than one might
think it needs; empowers them way beyond what your code might need, and
could be doing who knows what with your connection while you are trying
to do something else.

Nov 17 '05 #17
On Wed, 16 Nov 2005 21:50:57 -0600, "David W. Fenton"
<dX********@bway.net.invalid> wrote:

....
The trouble comes in when you use Access functions somewhere that
they prevent Access/JET from being able to delegate processing to
the back-end, such as when the function is used in a WHERE clause
or inside and aggregate function such as SUM(Round([Foo])). You
just need to be aware of these cases, and avoid them.


That may still be manageable if the number of records returned is
limited by some other criteria. It entirely depends on how you're
using the VBA function.


Absolutely true - so long as future conditions/requirements are given
appropriate consideration, of course.
Nov 17 '05 #18
In message <11*********************@z14g2000cwz.googlegroups. com>,
lylefair <ly***********@aim.com> writes
rkc wrote:
Here's a start.
http://www.microsoft.com/sql/prodinf...in-sqlserver20
05.mspx


Cool! So this means the end of Access, JET, DAO, VBA (and civlization)
as we know them?


Nobody knows. I'm pretty sure that nobody at Microsoft is certain. As I
understand it the next version of Office includes a new version of
Access that uses VBA. But Microsoft wants to get rid of VBA from all of
their products and replace it with the CLR system. That means being able
to use any .NET language.

The problem I see is that all of the .NET languages are too complicated
for at least part of the market for Access. So either Microsoft will
have to find a way of making writing .NET applications much simpler, or
it will have to retain VBA and support two different language families.
That is a possibility because there is a lot of pressure from VB6
programmers to continue support for VB as opposed to VB.NET. So we could
see VB.Classic and VBA surviving. Or not.

It's a problem that Microsoft has to resolve. The easy route from Access
to SQL Server is too valuable to break. They have to produce a version
of Access that non-programmers can use. Failure is not an option.

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Nov 17 '05 #19
Bri
lylefair wrote:
TC wrote:

By the way, what do you say to Steve's claim that T-SQL is a
performance killer?
As you can see I did not find that the UDF was slow; in fact it may
have had no appreciable slowdown at all [may even no slowdown at
all]. When compared with other "time" issues like the speed of data
over the wire, what other tasks the server might be performing when
you ask it to call the function etc, I think I am not going to worry
about it, barring Steve coming up with something I have overlooked.


Since Steve hasn't yet replied to this, I thought I might insert a quote
of his original assurtion to see if this helps calrify his point:

Steve Jorgensen wrote: On 16 Nov 2005 10:31:56 -0800, "TC" <go*********@yahoo.com> wrote:
Steve,

Thank you for the reply.

In fact, I expressed my question badly -- I'm really interested in
moving the functions to the back-end, so your comments on T-SQL are
most relevant to me. Is T-SQL really that slow? Suppose I choose
Oracle


T-SQL is not slow in general, however scalar functions really are
that slow. It basically means you don't use scalar functions much,
but other than that, MS SQL Server preforms quite well.
instead; does PL-SQL have the required capabilities, and is it
faster than T-SQL?

PL-SQL does have the capabilities, and its scalar function
performance is great, but Access works slightly better with the MS
SQL Server back-end, and
you have to make sure your ODBC settings are just right, for
PostgreSQL to work correctly with Access on the front-end.


--
Bri

Nov 20 '05 #20
On 16 Nov 2005 21:30:40 -0800, "lylefair" <ly***********@aim.com> wrote:

TC wrote:
By the way, what do you say to Steve's claim that T-SQL is a
performance killer?


I was interested in this statement, never having noted any particular
slowness, but then again, never really having considered the issue, so,
having woken up I decided to do a little test as below:

Option Explicit

Private Declare Function GetTickCount Lib "kernel32" () As Long

Sub TestUDFFullNameforSpeed()
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Dim t As Single
Dim z As Long

Set c = New ADODB.Connection
c.Open CurrentProject.AccessConnection.ConnectionString &
";Password=Password"

t = GetTickCount
For z = 1 To 100
' SELECT DISTINCT(dbo.FullName(Supplier,Article)) FROM Fabrics
Set r = c.Execute("QueryTemp")
Next z
Debug.Print r.RecordCount, GetTickCount - t
' with the UDF
' returns 16 distinct records 100 times in 9.654 seconds

t = GetTickCount
For z = 1 To 100
' SELECT DISTINCT Supplier,Article FROM Fabrics
Set r = c.Execute("QueryTemp2")
Next z
Debug.Print r.RecordCount, GetTickCount - t
' without a UDF
' returns 16 distinct records 100 times in 9.604 seconds

' function call seems to require 0.00003125 seconds per record
' how does that compare with using a VBA function
' who knows?

' note second call of function resulted in FullName function being
FASTER
' 16 9485
' 16 9917

' server is in California
' workstation is in Ontario, Canada about 4000 km distant

' connection is Cable Modem - Internet

' Access Version is 2003
' ADO is 2.5

End Sub

As you can see I did not find that the UDF was slow; in fact it may
have had no appreciable slowdown at all [may even no slowdown at all].
When compared with other "time" issues like the speed of data over the
wire, what other tasks the server might be performing when you ask it
to call the function etc, I think I am not going to worry about it,
barring Steve coming up with something I have overlooked.

I would add that I have found CurrentProject.Connection to be amazingly
slow in some situations and I try never to use it except in trivial
situations. (That's why I have created a separate connection here In a
project I generally have a public function that returns an independent
connection; Access typically opens more connections than one might
think it needs; empowers them way beyond what your code might need, and
could be doing who knows what with your connection while you are trying
to do something else.


As Bri pointed out, I was not making a negative statement about T-SQL
performance in general, just scalar functions. If I understand your post
correctly, you are testing the performance of a tabular function, and I have
not found those to have a performance problem.

To test what I'm talking about, try writing, say, a string formatting function
in T-SQL, and call that from within a SELECT statement.
Nov 20 '05 #21
Steve Jorgensen wrote:
As Bri pointed out, I was not making a negative statement about T-SQL
performance in general, just scalar functions. If I understand your post
correctly, you are testing the performance of a tabular function, and I have
not found those to have a performance problem.

To test what I'm talking about, try writing, say, a string formatting function
in T-SQL, and call that from within a SELECT statement.


I think it would be more efficient were you to post a function that is
slow.

Nov 20 '05 #22
On 20 Nov 2005 14:54:32 -0800, "lylefair" <ly***********@aim.com> wrote:
Steve Jorgensen wrote:
As Bri pointed out, I was not making a negative statement about T-SQL
performance in general, just scalar functions. If I understand your post
correctly, you are testing the performance of a tabular function, and I have
not found those to have a performance problem.

To test what I'm talking about, try writing, say, a string formatting function
in T-SQL, and call that from within a SELECT statement.


I think it would be more efficient were you to post a function that is
slow.


It would if I had easy access to that code right now, but I'll see if I can
make time to assemble and post a test to demonstrate the issue.
Nov 20 '05 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David | last post by:
Hi everyone. I have read every page that Google returns on this topic, but can't find anything that resolves my problem. Basically, I have an Access Database that does a number of different...
9
by: Marcin Kalicinski | last post by:
Hi, I have a set of C-like functions for file access (like fopen, fwrite, fread, fseek etc.). But I want to access the files using C++ stream, not these functions. What I probably need to do is...
2
by: Sean Mullaly | last post by:
I have a custom Access menu with sub-menus and sub-sub-menus. (220 items). Right now I have created 220 Functions and attached each individual Function to the specific OnAction property. The...
19
by: laurenq uantrell | last post by:
I'm using Access 2K. I'm hoping someone can tell me which method performs faster- (currently I'm using a mix of both methods) a.) creating custom properties and then calling functions to set and...
4
by: LhK-Soft | last post by:
Hi, I'm active in VC++ for several years now, so I know some things (I think). Using MS-Access I store a db with lots of entries and uses the VBA techniques to export those data to e.g. HTML, XML...
5
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
27
by: Wayne | last post by:
I've been clicking around Access 2007 Beta 2 and can't see the custom menu bar designer. Is it in the beta? Maybe I'm blind. The question that comes to mind is: Will custom menu bars be the same...
1
by: ncsthbell | last post by:
I have a dilemia, I have an application that I am having to make some changes to in order for it to run sucessfully under Runtime 2007. We are currently working on upgrading from 2000 to 2007. The...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.