Sequencer Errors

This section includes error messages for the Adaptive Server Sequencer. The Sequencer is the subsystem that controls command execution. The Sequencer handles the processing between steps in commands and also handles the procedural steps between commands such as if, goto, and while.




Error 207

Severity

16

Message text

Invalid column name '%.*s'.

Explanation

This error occurs when Adaptive Server tries to use a column name that does not exist.

Adaptive Server supports delimited identifiers for table, view, and column names. Delimited identifiers are object names enclosed within double quotation marks. Using them allows you to avoid certain restrictions on object names. Delimited identifiers can begin with nonalphabetic characters, including characters that would not otherwise be allowed. Delimited identifiers may even be Transact-SQL reserved words.

Delimited identifiers may cause some SQL statements to fail. For example, Error 207 would be raised for the column “none” in the following example:

1> select au_name, "none", au_fname
2> from pubs2..authors
3> go

Action

Check the spelling of the column name specified in the error message. If it is wrong, correct it in your SQL statement and run it again.

If this error message is being displayed because of delimited identifiers, either use single quotes instead of double quotes or turn delimited identifiers off. To turn delimited identifiers off, do the following:

1> use database_name
2> go

1> set quoted_identifier off
2> go

When delimited identifiers is turned on, delimiting strings with double quotes causes Adaptive Server to treat them as identifiers.

Additional information

Refer to the Transact-SQL User's Guide for information about delimited identifiers.

Versions in which this error is raised

All versions




Error 208

Severity

16

Message text

%.*s not found. Specify owner.objectname  or use sp_help to check whether the object exists (sp_help may produce lots  of output).

Explanation

This error occurs when Adaptive Server tries to use an object name that does not exist. If the object does exist, you may need to include the owner's name in the object name.

If the object is not owned by the user who is attempting to access it, and it is not owned by the database owner (“dbo”), all references to it must include the owner name. For example, if “user1” creates a table called test, all other users must prefix the table name with the owner name “user1” every time they refer to the object. The complete name in this example is user1.test. This requirement is based on Adaptive Server's naming convention for database objects:

database.owner.object_name.column_name 

The default value for database is the current database and the default value for owner is the current user. Remember that the owner is part of the object name and it is therefore possible for two different users to have two different tables with the same object_name in the same database, for example, user1.test and user2.test. Refer to the Transact-SQL User's Guide for more details on naming conventions.

Temporary tables reside in tempdb and are automatically dropped when the user process or Adaptive Server connection that created them is exited. Furthermore, users cannot share temporary tables, even if they are created by the “dbo.”

Including the fully qualified object name in an application may complicate the maintenance of the application. For example, if all references to a table include the database name, changing the database name could become quite difficult.

Action

To resolve this error, refer to one of the following sections, depending on how much you know about the object in question.


If You Do Not Know Who Owns the Table

You can either use the sp_help procedure to display the owner (if the procedure is executed with no parameters), or query the system catalog to determine the object's owner and type. For example, to determine the name and type of the object table1, use the following query:

1> select owner = user_name(uid), name, type 
2> from sysobjects where name = "table1" 
3> go

If no rows are returned by this query, the object may reside in a different database or may not exist at all.


If You Do Not Own the Object In Question

Avoid this error using either procedure:


If the Object Does Not Reside in the Database

The error can be avoided by:

The owner name is not needed if you own the object or if it is owned by the “dbo.” For example:

1> select * from database1..table1 
2> go

The appropriate permissions must also be set to allow access to this object. If these permissions are not provided, a 229 or 230 error results.

Versions in which this error is raised

All versions




Error 213

Severity

16

Message text

Insert error: column name or number of supplied  values does not match table definition.

Explanation

This error occurs when there is a mismatch between the information specified in an insert statement and the definition of the table.

Following are some examples of insert statements for the pubs2.titles table that cause this error (assuming that the titles table has nine columns):

Action

Check your insert statement to make sure you have specified column names and values for the columns.

If this error message is being displayed while an application is being run, use the following information to determine which insert statement is causing the problem.

Data Workbench

To see the SQL text being sent by Data Workbench to Adaptive Server, use the environment variable RECTFOS. When RECTFOS is defined, the application records the SQL text in a file that you can review for debugging a new application or diagnosing other problems.

Before starting Data Workbench, set the value of RECFTOS to the file name where you want the text to be saved:

A new file is created for each connection made to Adaptive Server. The files are named sequentially as each connection is opened: filename.0;1 (OpenVMS), filename.1 (UNIX), and so on.

This feature is present in Data Workbench 2.2 and later releases.

Use unsetenv (UNIX) or deassign (OpenVMS) to turn off logging when you no longer need to save the SQL text being sent.

Open Client Applications

To see the SQL text being sent by Open Client applications, use the dbrecftos call. Refer to the Open Client DB-Library Reference Manual for details.

Versions in which this error is raised

All versions




Error 216

Severity

20

Message text

Attempt to automatically drop temporary table failed.

Explanation

Adaptive Server goes through four phases while processing a query:

  1. Parsing – checks the query to make sure the syntax is correct

  2. Normalization – resolves the column and table names and generates a query tree

  3. Compilation – performs optimization and generates a query plan

  4. Execution – carries out the query plan

During the first three phases of query processing, Adaptive Server creates two types of temporary tables:

Error 216 occurs when Adaptive Server is unable to drop one of the temporary tables it created. It is probably caused by an Adaptive Server problem.

Error 216 occurs with the following states:

State

Meaning

1

During the renormalization phase, if Adaptive Server cannot drop a temporary table it created, Error 216 occurs with State 1. These are definition-time temporary tables.

2

During the normalization phase, if Adaptive Server cannot drop a temporary table it created during the parsing phase, Error 216 occurs with State 2.

3

During an abort of the normalization phase, if Adaptive Server cannot drop a temporary table, Error 216 occurs with State 3.

4

When a process is killed, if Adaptive Server fails to clean up temporary tables, Error 216 occurs with State 4. These can be definition-time or normal temporary tables.

5

If there is an error during the normalization phase, and Adaptive Server cannot drop a temporary table it created during normalization, Error 216 occurs with State 5.

6

Similar to State 5.

7

During recompilation of a lightweight procedure, if Adaptive Server is unable to drop a definition-time temporary table, Error 216 occurs with State 7.

9

If there is an error during creation of a temporary view, and Adaptive Server cannot drop a temporary table it created during normalization, Error 216 occurs with State 9.

10

When processing nested SQL (for example, nested SQL statements within a Java method), if Adaptive Server cannot drop a temporary table at cleanup, Error 216 occurs with State 10.

11

Similar to State 10.

12

When processing client or language cursors, if Adaptive Server cannot drop a temporary table at cleanup, Error 216 occurs with State 12.

13

When regenerating a stored procedure during upgrade, if Adaptive Server cannot drop a normalization-time temporary table at cleanup, Error 216 occurs with State 13.

14

Similar to State 13, but it applies to definition-time temporary tables.

Action

Temporary tables left behind are not in themselves a problem. However, they do take up space in tempdb, and tempdb may eventually fill up. If you think this is a potential problem, shut down and restart Adaptive Server. This will re-create tempdb and thus drop all temporary tables.

216 can result from running out of locks. Check the ASE error log; if the 216 error is preceded by 1204 errors in the log, you may not have enough locks configured. Follow the instructions in the 1204 writeup elsewhere in this manual.

If Error 216 persists, call Sybase Technical Support.

Versions in which this error is raised

All versions




Error 225

Severity

11

Message text

Cannot run query--referenced object (name  %.*s) dropped during query optimization.

Explanation

This error occurs when Adaptive Server fails to build an execution plan for a stored procedure or an ad-hoc query because a referenced object was not found.

Some reasons for this error include:

This is not a serious error as it does not indicate corruption. However, it may prevent you from running some stored procedures and ad-hoc queries.

This error usually means a problem has occurred with Adaptive Server.

Action

Using sp_configure, review the value of the configuration parameter number of open objects and increase this value if feasible. For information about memory-related configuration parameters, refer to:

If you cannot increase the value of number of open objects or the 225 error occurs again, call Sybase Technical Support for assistance.

Versions in which this error is raised

All versions




Error 226

Severity

16

Message text

%s command not allowed within  multi-statement transaction.

Explanation

SQL commands are grouped into the following categories:

Error 226 occurs when Adaptive Server detects a command that is not allowed in a multi-statement transaction. A multi-statement transaction is a set of commands prefaced with the begin transaction command.

The following commands are never allowed in multi-statement transactions:

The following commands are not normally allowed in multi-statement transactions but you can use them if you use sp_dboption to set ddl in tran to TRUE first:

Action

If the command is allowed in a multistatement transaction when ddl in tran is set to TRUE, set ddl in tran to TRUE before running the transaction. Setting ddl in tran to TRUE causes locks on system tables and this can affect performance. You can check the current setting of ddl in tran with sp_helpdb.

If the command is never allowed in a multi-statement transaction, execute it outside the multi-statement transaction.

Additional information

Some applications take SQL statements as input and run them for you. If the application uses begin and commit or rollback transaction to surround those statements, Error 226 may occur. Refer to the user guide for your application to determine if this is the case.

Versions in which this error is raised

All versions




Error 229

Severity

14

Message text

%s permission denied on object %S_OBJID, database %S_DBID, owner %.*s

Explanation

This error occurs when Adaptive Server attempts to access an object for which you do not have the appropriate permission.

Error 229 can occur during any transaction which involves objects, such as bcp, select, or update.

This error causes a rollback of the current transaction. Remaining commands in the batch are not executed and processing continues at the next batch.

Action

Check permission on the object named in the error message:

1> use database_name
2> go

1> sp_helprotect object_name
2> go

where database_name is the name of the database in the error message and object_name is the name of the object in the error message.

Grant the needed permission to the object (you either need to own the object or be the “sa” to do this). For example, to give Mary permission to insert into and delete from the titles table, type the following:

1> grant insert, delete
2> on titles
3> to mary
4> go

Additional information

Refer to “Managing User Permissions” in the Security Administration Guide for detailed information about permissions.

Versions in which this error is raised

All versions




Error 232

Severity

16

Message text

Arithmetic overflow error for type %s, value = %f.

Explanation

This error occurs when Adaptive Server detects an arithmetic overflow error during execution of a SQL statement. Arithmetic overflows occur when a variable has too few places to store the converted data. In particular, Error 232 is raised when an overflow occurs for a variable of datatype float.

Error 232 can occur during execution of the convert function. It can also occur during implicit conversion within Adaptive Server, either during a stored procedure run or during execution of a SQL statement which converts a float value to some other datatype.

Action

Determine which variable is causing the problem based on the datatype reported in the error message output and the SQL statement on which the error occurred. If the error occurs within a stored procedure, an additional error message will be displayed showing the name of the stored procedure and the line number where the error occurred.

Increase the size of the variable that is causing the error. If it is in a procedure, re-create the procedure.

If this error occurs on a Sybase-supplied system stored procedure, contact Sybase Technical Support.

Versions in which this error is raised

All versions




Error 233

Severity

16

Message text

The column %.*s in table %.*s does not allow null values.%S_EED

Explanation

During query processing, Adaptive Server performs an action called normalization, during which it resolves column and table names and generates a query tree. During normalization, when Adaptive Server prepares the target list for processing an insert or update, it checks to make sure nulls are allowed. Error 233 will be raised at compile time if, from within a stored procedure, you try to insert null values in a column which does not allow nulls.

Error 233 is raised with the following states:

State

Meaning

1

Nulls are not allowed, the column is in the target list, and the value being inserted is null.

2

No default exists, nulls are not allowed, and the column is not in the target list.

3

For inserts to temporary tables, Adaptive Server checks to be sure all “not null” columns are listed explicitly. If a “not null” column is not listed in the insert statement, the error is raised with State 3.

Action

When you create a table, you can explicitly define whether each column should allow null values. If you do not specify NULL or NOT NULL for a column when you create the table, the default value will be NOT NULL. If you use sp_dboption to set allow nulls by default to TRUE for the database, any new table that is created will have columns with the default value NULL.

To determine whether a column has NULL or NOT NULL defined, enter commands like the following, replacing “pubs2” by the database in which your table resides and “titleauthor” by the table in which your column resides:

1> use pubs2
2> go

1> sp_help titleauthor
2> go

Name          Owner   Type
------------------------------------------------------------ 
titleauthor   dbo     user table            
Data_located_on_segment        When_created
------------------------------ -----------------------------
default                        Oct 27 1994 10:09AM 

Column_name Type Length Prec Scale Nulls Default_name Rule_name Identity
------------------------------------------------------------------------
au_id       id       11 NULL NULL  0     NULL         NULL      0 
title_id    tid       6 NULL NULL  0     NULL         NULL      0 
au_ord      tinyint   1 NULL NULL  1     NULL         NULL      0 
royaltyper  int       4 NULL NULL  1     NULL         NULL      0 

The Nulls column indicates whether null values are allowed. A value of 0 for the column means nulls are not allowed; a value of 1 means null values are allowed.

To change the default for a column from NOT NULL to NULL:

  1. Use bcp to copy the data out of the existing table.

  2. If you want the modified table to have the same name as the existing table, drop the old table.

  3. Re-create the original table, specifying NULL for the column you want to change.

  4. Use bcp to put back the data for the table.

If you want new tables in the database to have the default NULL, use the following commands for the database:

1> use master
2> go

1> sp_dboption database_name, 
2> "allow nulls by default", true
3> go

1> use database_name
2> go

1> checkpoint
2> go

where database_name is the name of the database whose behavior you want to change.

Versions in which this error is raised

All versions




Error 241

Severity

16

Message text

Scale error during %S_MSG conversion of %s value ’%s’ to a %s field.

Explanation

Error 241 occurs when ASE attempts to convert a given value from one numeric or decimal datatype to another, but is unable to do so because the scale of the receiving field (the "to" field in the message) is not large enough to accommodate the converted value.

The error is raised during implicit conversions, which occur when Adaptive Server performs certain types of comparisons, and while the server stores and retrieves data. Adaptive Server automatically handles conversions between compatible datatypes, but may be unable to handle the numeric or decimal conversion due to the reasons mentioned above.

For example:

1> declare @numvar numeric(5,2)
2> select @numvar = 38.4434
3> go

Msg 241, Level 16, State 2:
Server ’vin_125_ocstest’, Line 2:
Scale error during implicit conversion of NUMERIC value ’38.4434’ to a NUMERIC field.

The scale of the numeric field numvar (2) is too small to accept the inserted value.

Action

Options for resolving the error include

  1. Setting arithabort numeric_truncation off, OR

  2. Using the convert function, OR

  3. Declaring a large enough scale explicitly.

Setting arithabort off

You can use arithabort to direct Adaptive Server not to abort the query due to a numeric truncation error:

1> set arithabort numeric_truncation off
2> go
1> declare @numvar numeric(5,2)
2> select @numvar = 38.44*.72
3> select @numvar
4> go

(1 row affected)
--------
27.67

Using the convert function

You can use the general-purpose convert function to specify the output:

1> declare @numvar numeric(5,2)
2> select @numvar = 38.44
3> select @numvar=convert(numeric(5,2),@numvar*.72)
4> select @numvar
5> go

(1 row affected)
(1 row affected)
--------
27.67
(1 row affected)

Declaring the Variable’s Scale

You can declare an appropriately large scale when defining the variable. Instead of

1> declare @x decimal
2> select @x = 12.345

use

1> declare @x decimal (5,3)
2> select @x = 12.345

Additional information

The set arithabort and set arithignore options specify behavior following loss of precision or (for numeric and decimal types) loss of scale. For more information see:

In writing your SQLJ java methods (ASE 12.5 and higher), you can avoid 241 errors by making sure that input parameters for the function calling the java method use the proper scale and precision, as described in Declaring the Variable’s Scale under Action above.

Versions in which this error is raised

All versions




Error 247

Severity

16

Message text

Arithmetic overflow during %S_MSG conversion of %s value '%s' to a %s field.

Explanation

Error 247 occurs when Adaptive Server attempts to convert a given value from one data type to another, but is unable to do so because of incompatibilities between the datatypes, or when the receiving field (the "to" field in the message) does not have a range large enough to accomodate the converted value.

The error may be raised during either explicit or implicit conversions. Explicit conversions occur when a query explicitly requests a conversion with the convert, inttohex, or hextoint functions.

Implicit conversions occur when Adaptive Server is required to perform certain types of comparisons between heterogeneous datatypes, and when the server stores and retrieves data. Adaptive Server automatically handles many such conversions from one datatype to another, but may be unable to handle the conversion due to the reasons mentioned above.

For example:

1> create table deliver_dates
2> (itemno int,
3> dlydate smalldatetime)
4> go

1> insert into deliver_dates
2> values (42298, '12/12/2080')
3> go

Line 1: Arithmetic overflow during implicit conversion of 
VARCHAR value '12/12/2080' to a SMALLDATETIME field.

The date value being inserted is outside the range of SMALLDATETIME.

Action

Check the following problem areas when you see Error 247:

  1. Is the range of the receiving datatype large enough to accomodate the converted value?

  2. Are the sending and receiving datatypes (the "of" and "to" datatypes in the message, respectively) compatible? For details refer to "Datatype Conversion Functions" in the Reference Manual.

  3. Is the query attempting to display a FLOAT value by converting it to numeric datatype? FLOATs can only be displayed this way if no decimal digits are lost. Try increasing the precision of the numeric field so that this condition is met.

  4. If the query is updating a table, is there a trigger on the table that attempts to place the new value into another table? The receiving field in the second table may not have the correct range for the operation.

Additional information

Have the following information ready when you call Sybase Technical Support:

Versions in which this error is raised

All versions




Error 257

Severity

16

Message text

Implicit conversion from datatype '%s' to '%s' is not allowed.  Use the CONVERT function to run this query.

Explanation

When performing certain types of comparisons, and while storing and retrieving data, Adaptive Server automatically handles many conversions from one datatype to another. These are called implicit conversions. You can explicitly request other conversions with the convert, inttohex, and hextoint functions.

Error 257 is raised when Adaptive Server is unable to do an implicit conversion because of incompatibilities between the datatypes.

Action

Corrective action depends on the exact situation in which the error occurred. Here are some typical situations where Error 257 is raised, and how you can correct the problem:

and there are 255 characters preceding `%', Error 257 is raised. Adaptive Server treats the comparison string as containing more than 255 characters and assumes that it is a TEXT datatype, which it cannot convert implicitly.

Additional information

For detailed information about datatype conversions, refer to the section “Datatype Conversion Functions” of “Using the Built-In Functions in Queries” in the Reference Manual.

Before calling Technical Support, have the following information available:

Versions in which this error is raised

All versions




Error 259

Severity

16

Message text

Ad-hoc updates to system catalogs not enabled. A user  with System Security Officer (SSO) role must reconfigure system to  allow this.

Explanation

System tables are all the Sybase-supplied tables in the master database and in each user database that begin with “sys” and have an ID value in the sysobjects table of less than or equal to 100. The system catalog is the collection of system tables.

Error 259 occurs when you try to directly modify an Adaptive Server system table without first using sp_configure to set the allow updates configuration parameter. Setting this variable allows the System Administrator (“sa”) to make changes to system tables.

WARNING! Serious problems can result from an incorrectly modified system table! Make changes only if Sybase Technical Support or this manual instructs you to do so.

Action

Do not use any of the procedures in this section before reading all warnings and cautions! Incorrect alterations of a system table can result in database corruption and data loss.

To successfully modify the system catalog as directed by Technical Support or this guide, use the following procedure:

  1. As “sa,” use sp_configure to allow changes to the system catalog:

    1> sp_configure "allow updates", 1
    2> go
    

  2. Make changes to the system catalog as directed by Technical Support or elsewhere in this guide. Always use begin transaction when changing a system table, to protect against errors which could corrupt your database.

    WARNING! Be sure to include the next step to protect your system.

  3. Immediately following the changes, use sp_configure to disallow changes to the system catalog (the normal state for Adaptive Server):

    1> sp_configure "allow updates", 0
    2> go
    

    You must return Adaptive Server to its normal state, or anyone who can log on as “sa” can make changes to the system tables, or create stored procedures which do so.

  4. If you update sysusages, sysobjects, sydatabases, or sysdevices, restart Adaptive Server. You need to do this because structures related to those tables are stored in cache and will not be updated until you restart Adaptive Server.

Additional information

Refer to “allow updates to system tables” configuration parameter in the System Administration Guide and “sp_configure” in the ASE Reference Manual for more information about (sp_configure) allow updates.

Versions in which this error is raised

All versions




Error 265

Severity

16

Message text

Insufficient result space for %S_MSG conversion  of %s value '%s' to a %s field. 

Explanation

Error 265 can be raised in the following situations:

Examples and corrective action are provided in the next section.

Action

The following sections describe some scenarios under which Error 265 occurs and ways of dealing with those situations.


Errors in Integer Conversion

Conversions of integer to character data will fail if the target format is not large enough to accommodate the data:

1> select convert (char(1), 500) 
2> go

Msg 265, Level 16, State 1:
Server 'mfg1', Line 1:
Insufficient result space for explicit conversion of 
INT value '500' to a CHAR field.

To correct this problem, choose a larger target format (char(3) in the example).


Errors in Floating Point Conversion

Conversions of floating point to character data will fail if the target format is not large enough to accommodate the data:

1> select convert (char(10), 3.1415e) 
2> go

Msg 265, Level 16, State 1:
Server 'mfg1', Line 1:
Insufficient result space for explicit conversion of 
FLOAT value '3.1415000000000002' to a CHAR field.

As in this example, the trailing part of the source value reported in the error message can be different from the entered value. This is because FLOAT is an approximate numeric datatype whose internal representation (and rounding upon display) are platform-dependent.

To correct this problem, choose a larger target format for display. Use the str function to determine the necessary format. The required format varies depending upon the number being converted and the accuracy of floating point numbers supported by your platform. To guarantee success, use a target of 25 characters.

If loss of precision (rather than display format) is a concern in the application, consider using an exact numeric datatype such as integer, numeric or decimal.

Additional information

Refer to the Transact-SQL User's Guide for information about the str function.

Versions in which this error is raised

All versions




Error 266

Severity

10

Message text

Transaction count after EXECUTE indicates that  a COMMIT or ROLLBACK TRAN is missing. Previous count = %ld,  Current count = %ld.

Explanation

When a stored procedure is run, Adaptive Server maintains a count of open transactions, adding 1 to the count when a transaction begins, and subtracting 1 when a transaction commits. When you execute a stored procedure, Adaptive Server expects the transaction count to be the same before and after the stored procedure execution. Error 266 occurs when the transaction count is different after execution of a stored procedure than it was when the stored procedure began.

The 266 error occurs most often when stored procedures are executed in chained mode. In chained mode, if there is no explicit begin transaction statement, an implicit begin transaction is issued. A begin transaction statement, whether implicit or explicit, increments the session transaction count by 1.

In chained mode, the following statements cause an implicit begin transaction to be issued: select, update, delete, insert, and fetch. (The fetch command begins a transaction only when close on endtran is off in chained mode and cursors can remain open across transactions. Refer to “set” in the Reference Manual for a discussion of the close on endtran option of the set command.)

Each begin transaction statement in a stored procedure, whether implicit or explicit, must be balanced by a commit transaction statement, which decrements the session transaction count by 1. Otherwise, the transaction count remains higher when the stored procedure exits than it was at the beginning of execution.

In addition, Error 266 occurs when you are using nested procedures, and procedures at each level of nesting include begin, commit, and rollback transaction statements. If a procedure at a lower nest level opens a transaction and one of the called procedures issues a rollback transaction, Error 266 occurs when you exit the nested procedure. The following example illustrates this situation:

1> create procedure proc1
2> as
3> begin transaction
     .
     .
     execute proc2
4> commit transaction
5> go

1> create procedure proc2
2> as
3> begin transaction
     .
     .
4> rollback/commit transaction
5> go

If proc2 executes a rollback transaction, it returns with Error 266.

Action

In the following example, execution of the stored procedure “test” results in a 266 error:

1> use pubs2 
2> go

1> create procedure test as 
2> select * from titles 
3> go 

1> sp_procxmode test, chained 
2> go 

1> set chained on 
2> go

1> execute test 
2> go

The transaction count is 0 before executing stored procedure “test”. When the stored procedure is executed, its select statement causes a transaction to begin implicitly. Since there is no balancing commit transaction for the implicit begin transaction the transaction count is not decremented in the stored procedure. The stored procedure returns to the caller with a transaction count of 1. A non-fatal 266 error is raised.

To balance the implicit begin transaction within a stored procedure, issue a commit statement before exiting the stored procedure, as in the following example:

1> use pubs2 
2> go 

1> create procedure test as 
2> select * from titles 
3> commit transaction 
4> go 

1> sp_procxmode test, chained 
2> go 

1> set chained on 
2> go

1> execute test 
2> go

The transaction count is 0 before stored procedure execution. When the stored procedure is executed, the select results in an implicit begin transaction and the transaction count is incremented to 1. The commit transaction in the stored procedure decrements the transaction count to 0. The transaction count is the same at the end of stored procedure execution as it was in the beginning.

You can use the @@trancount global variable to check the transaction count at the beginning and end of the procedure. If the count is not equal, commit or roll back transactions as appropriate.

NoteIt is safer to commit within the stored procedure than to open the transaction explicitly before executing the stored procedure. Opening the transaction before executing the stored procedure carries the risk of leaving a transaction open if the execute procedure statement fails and causing other problems as your procedures get more complicated.

Additional information

For more information on transactions within stored procedures and the @@trancount global variable, refer to the section “Checking the Transaction Nesting Level with @@trancount” of “Using Batches and Control-of-Flow Language” in the Transact-SQL User's Guide.

Versions in which this error is raised

All versions




Error 268

Severity

16

Message text

You can't run SELECT INTO in this database. Please check with the Database Owner.

Explanation

This error occurs when you try to add rows to a table via the select into clause in a database that has the sp_dboption option select into/bulkcopy parameter disabled.

If this error occurs while trying to select into a temporary table, or while running a Sybase-supplied stored procedure, it is likely that the select into/bulkcopy option is not enabled in tempdb. Some stored procedures, for example sp_help and sp_helpsort, trigger this error because they select into temporary tables (which all belong to tempdb) to get reports from the system tables, and to update them. If tempdb does not have the sp_dboption option select into/bulkcopy enabled, Error 268 will occur.

NoteWhen you install Adaptive Server, the select into/bulkcopy option is enabled in tempdb and turned off in all other databases.

The sp_dboption option select into/bulkcopy must be enabled to perform nonlogged operations. For example:

Action

Ask the System Administrator (“sa”) or database owner (“dbo”) to enable the sp_dboption option select into/bulkcopy for all databases affected by the query (including tempdb if applicable). The “sa” or “dbo” can use this procedure:

  1. Use the master database and change the option:

    1> use master 
    2> go
    

    1> sp_dboption database_name, 
    2> "select into/bulkcopy", true 
    3> go
    

    1> use database_name 
    2> go
    

    1> checkpoint 
    2> go
    

  2. To verify that the change is active, use sp_helpdb:

    1> sp_helpdb database_name 
    2> go
    

    In the output, the phrase select into/bulkcopy should appear, indicating that the option is enabled.

    WARNING! Dump your database before disabling the select into/bulkcopy option. If you insert nonlogged data (via a nonlogged operation) into the database, you will not be able to dump the transaction log to a device, and will not be able to recover your data.

By default, the select into/bulkcopy option is disabled when a database is first created. To change this default, use the procedure above to allow the option in the model database.

Additional information

If a table has indexes or triggers, then bcp will not run in the fast mode, so you do not need to set the select into/bulkcopy option to run bcp.

You cannot dump the transaction log to a device after performing a minimally logged operation. Trying to dump the transaction log after a minimally logged operation causes error messages that instruct you to dump the database instead.

Versions in which this error is raised

All versions




Error 277

Severity

16

Message text

There was a transaction active when exiting the stored  procedure '%.*s'. The temporary table '%.*s' was dropped  in this transaction either explicitly or implicitly. This transaction  has been aborted to prevent database corruption.

Explanation

When exiting a stored procedure, Adaptive Server checks to see whether there is an active transaction (a transaction that has not been committed) and then checks to see whether any temporary objects exist for that uncommitted transaction.

If temporary objects exist, the transaction is rolled back, the temporary objects are dropped, and Error 277 is raised.

Action

In stored procedures, make sure all begin transaction statements have corresponding commit transaction or rollback transaction statements.

In chained mode, if there is no explicit begin transaction statement, an implicit begin transaction is issued. If you are using chained mode, an explicit commit transaction or rollback transaction statement is required to end the transaction.

If you confirm that all begin transaction statements have corresponding commit transaction or rollback transaction statements, check to see whether the stored procedure is exiting without completing its processing.

Versions in which this error is raised

All versions