T
Tom Carter
I'm moving an application from being a pure Access MDB to an Access 2000
project against SQL Server. I have encountered one situation which has me
frustrated for lack of an easy solution.
In the MDB code, I had one dynamic SQL string to execute that was about 3000
characters long. Please note that I have already trimmed table name
qualifiers and used short aliases where possible to shorten the query, so
it's not necessary to recommend that.
To get around the recordsource length limitation with the MDB, it was simple
enough to assign the query to the .SQL property of a QueryDef
(CurrentDb.QueryDefs("myquery").SQL = "SELECT...") and then assign the name
of the query to the recordsource. Since each query is stored in a local MDB
file which connects to a backend database, this is considered multi-user
"safe".
How do I achieve the same result with an Access project against SQL Server?
It appears that the recordsource length limitation still applies, but
creating a view on the server is not safe in a multi-user situation because
multiple users might concurrently be trying to create or access the same
view with the same name.
I've come up with what I would consider two "hacks".
1.) Create a view dynamically with a different name everytime ("myview1",
"myview2", "myview3", ...)
2.) Create a stored procedure which takes a large number of parameters
I really don't like #1, since a large number of views might be left on the
server is the code to remove them has any problems.
Is #2 really the only way? If so, can I assign a stored procedure call with
parameters to a recordsource? If so, what is the syntax for this? Are there
any issues with setting the controlsource of controls on the form? Is it
simple enough to just name the returned columns from a stored procedure and
use that name as I would the name of a column from a view?
Thanks in advance,
Tom
project against SQL Server. I have encountered one situation which has me
frustrated for lack of an easy solution.
In the MDB code, I had one dynamic SQL string to execute that was about 3000
characters long. Please note that I have already trimmed table name
qualifiers and used short aliases where possible to shorten the query, so
it's not necessary to recommend that.
To get around the recordsource length limitation with the MDB, it was simple
enough to assign the query to the .SQL property of a QueryDef
(CurrentDb.QueryDefs("myquery").SQL = "SELECT...") and then assign the name
of the query to the recordsource. Since each query is stored in a local MDB
file which connects to a backend database, this is considered multi-user
"safe".
How do I achieve the same result with an Access project against SQL Server?
It appears that the recordsource length limitation still applies, but
creating a view on the server is not safe in a multi-user situation because
multiple users might concurrently be trying to create or access the same
view with the same name.
I've come up with what I would consider two "hacks".
1.) Create a view dynamically with a different name everytime ("myview1",
"myview2", "myview3", ...)
2.) Create a stored procedure which takes a large number of parameters
I really don't like #1, since a large number of views might be left on the
server is the code to remove them has any problems.
Is #2 really the only way? If so, can I assign a stored procedure call with
parameters to a recordsource? If so, what is the syntax for this? Are there
any issues with setting the controlsource of controls on the form? Is it
simple enough to just name the returned columns from a stored procedure and
use that name as I would the name of a column from a view?
Thanks in advance,
Tom