Select....Into statement failing from remote client.

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

I've got SQL Server 6.5 and when I access from a client on the same machine as the server, there isn't a problem.

However from another client via a LAN this statement fails with the message:

'An into clause is not allowed in a cursor declaration'

Any ideas??

-- Anonymous, February 26, 1999

Answers

Mark,

Could you please show me the statement?

Eric

-- Anonymous, February 26, 1999


Sprintf(line, "SELECT UserID, UserName, Domain, Type INTO %s FROM %s", stored_tablename, hMemberDB->CurrentTableName);

where stored_tablename exists and hMemberDB->CurrentTableName does not (using c).

SQL_SetConnectOption(hMemberDB->odbcConnection, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC); SQL_SetConnectOption(hMemberDB->odbcConnection, SQL_ROWSET_SIZE, 5);

I am also setting the connect option as above and I have also set the sp_dboption to 'select into/bulk copy'.

It's bewildering...............

-- Anonymous, March 01, 1999


Mark,

When I use ISQL/W to try to execute (from any DB) a statement like: DECLARE junk_cursor CURSOR FOR SELECT name into tempjunk FROM sysobjects

I get the error message: Msg 154, Level 15, State 3 An INTO clause is not allowed in a cursor declaration.

This makes sense to me, because a "select into" returns no rows. A cursor needs to have (at least the possibility of) rows. Therefore, an error message is generated because the interpreter knows that no rows can be generated from a select into.

The mystery is that it seemed to work on the server.

Hope this helps,

Eric

-- Anonymous, March 05, 1999


Moderation questions? read the FAQ