VistaDB 6
VistaDB / Developer's Guide / SQL Reference / SQL Reference - System Variables
In This Topic
SQL Reference - System Variables
In This Topic
Variable Name Description
@@IDENTITY Valid after Inserts Only
@@VERSION Returns the current version of the engine (does not require a database connection in order to execute)
@@TRANCOUNT Returns the number of currently open transactions.

System Variables Example
Copy Code
select @@VERSION;

Open SQL Query: select @@VERSION;
SQL Query opened
Rows selected: 1

VistaDB 4.1 (C) 2009 VistaDB Software, Inc. All rights reserved. Provider: 4.1.15

SELECT @@IDENTITY;

Open SQL Query: select @@IDENTITY;
SQL Query opened
Rows selected: 1


SELECT @@TRANCOUNT;

Open SQL Query: select @@TRANCOUNT;
SQL Query opened
Rows selected: 0

Example

The following is an example of how to use the @@IDENTITY variable.
Select Identity Example
Copy Code
// Execute this after performing an INSERT
using( VistaDB.Provider.VistaDBCommand command = new VistaDB.Provider.VistaDBCommand() )
{
command.Connection = connection;
command.CommandText = "SELECT @@IDENTITY";
string iresult = command.ExecuteScalar().ToString();
Console.WriteLine("IDENTITY WAS: " + iresult);
}
See Also