Showing posts with label clause. Show all posts
Showing posts with label clause. Show all posts

Wednesday, March 28, 2012

MDAC 2.8 and cursor FETCH NEXT

it seems that starting with MDAC 2.8 the FETCH NEXT statement for cursors requires an INTO clause. otherwise an unspecified error is returned.
so it's not possible to scroll through the records anymore without storing the values of the fields into local variables?Can you post the error code/description ?|||the following code executes from a connection object without issues using ado 2.6 and 2.7:

DECLARE c8281 CURSOR FOR
SELECT * From Users WHERE ( Users.User_ID = 17 )
OPEN c8281
FETCH NEXT FROM c8281
UPDATE [Users] SET
User_Name = 'Unknown'
WHERE CURRENT OF c8281
CLOSE c8281
DEALLOCATE c8281

however, if I use ADO 2.8 it returns error code 80004005 (unspecified error) and native error = 0. furthermore, it actually executes at the database server.

I made it work without errors by modifying the code in the following way:

DECLARE @.username VARCHAR
DECLARE c8281 CURSOR FOR
SELECT User_Name From Users WHERE ( Users.User_ID = 17 )
OPEN c8281
FETCH NEXT FROM c8281 INTO @.username
UPDATE [Users] SET
User_Name = 'Unknown'
WHERE CURRENT OF c8281
CLOSE c8281
DEALLOCATE c8281

which is closer to ansi92 I guess. but I just really need to scroll through the cursor. no need for local variables.

Monday, March 19, 2012

Maximum size of the contains_search_condition clause in a CONTAINS statement

Hi,
We're using the SQL Server Full Text Engine to implement a search engine. Users can enter queries which are then executed using the CONTAINS statement. I can't find any documentation that indicates the maximum allowable size of the contains_search_conditi
on clause. Our users' search terms can be quite complex with many Boolean predicates. As a result they can become quite long: several hundred or even a few thousand characters long. What is the upper size limit?
Many thanks,
Dan
Dan,
There was an early bug in SQL Server 2000 RTM that limited the max character
length to 1023 (1K -1), but it was fixed in SP1.
I believe that the max character limit was extended to the max length of
char/varchar datatype length of 8000.
Regards,
John
"Dan Crow" <anonymous@.discussions.microsoft.com> wrote in message
news:A46B5192-072F-4DF0-8D9E-F44D955EDB58@.microsoft.com...
> Hi,
> We're using the SQL Server Full Text Engine to implement a search engine.
Users can enter queries which are then executed using the CONTAINS
statement. I can't find any documentation that indicates the maximum
allowable size of the contains_search_condition clause. Our users' search
terms can be quite complex with many Boolean predicates. As a result they
can become quite long: several hundred or even a few thousand characters
long. What is the upper size limit?
> Many thanks,
> Dan