Difference between revisions of "SYNCNUM()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
''Note: The SYNCNUM Pseudo Column has been replaced with the SYNCNUM() function.''
 +
 +
 
==Purpose==
 
==Purpose==
Return the unique sequence number assigned to a row from the specified table
+
Function to return the unique sequence number assigned to a row from the specified table
  
  
 
==Syntax==
 
==Syntax==
SYNCNUM
+
SYNCNUM([<workarea | alias>])
  
  
 
==See Also==
 
==See Also==
[[SQL INSERT|INSERT]], [[Optimizing Indexes using SYNCNUM]], [[SQL Pseudo Columns|PSEUDO COLUMNS]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
+
[[CURSYNCNUM()]], [[SQL INSERT|INSERT]], [[Optimizing Indexes using SYNCNUM]], [[RECNO()]], [[ROWNUM()]], [[SQL Pseudo Columns|PSEUDO COLUMNS]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
  
  
 
==Description==
 
==Description==
A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated.  Pseudo Columns provide extra information about a SELECT row set.
+
The SYNCNUM() function returns the unique sequence number assigned to a row from the specified table. The SYNCNUM() function operates on the current workarea unless a numeric <workarea> or character <alias> is specified.  
  
The SYNCNUM pseudo column will return the unique sequence number assigned to a row from the specified table. Each new row inserted into a table will be assigned a unique sequence number for that table. Even if the row is deleted later or if all the rows are deleted from the table, that number will not be issued again.
+
Each new row inserted into a table will be assigned a unique sequence number for that table. Even if the row is deleted later or if all the rows are deleted from the table, that number will not be issued again.
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
// Display all overdue accounts with 15% commission in
+
OPEN DATABASE southwind
// Sorted "name" and "paid date" order with the unique row sequence number.
+
SELECT syncnum(), recno() FROM example
EXEC SQL
+
SELECT SYNCNUM, name, address, balance, cost*1.15
+
FROM accounts
+
WHERE paid_date < date()
+
ORDER BY name, paid_date;
+
 
</code>
 
</code>
  
Line 33: Line 31:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:Pseudo Columns]]
+
[[Category:Functions]]
 +
[[Category:Table Basics]]
 +
[[Category:Table Basics Functions]]

Latest revision as of 11:07, 5 July 2011

Note: The SYNCNUM Pseudo Column has been replaced with the SYNCNUM() function.


Purpose

Function to return the unique sequence number assigned to a row from the specified table


Syntax

SYNCNUM([<workarea | alias>])


See Also

CURSYNCNUM(), INSERT, Optimizing Indexes using SYNCNUM, RECNO(), ROWNUM(), PSEUDO COLUMNS, SELECT, UPDATE


Description

The SYNCNUM() function returns the unique sequence number assigned to a row from the specified table. The SYNCNUM() function operates on the current workarea unless a numeric <workarea> or character <alias> is specified.

Each new row inserted into a table will be assigned a unique sequence number for that table. Even if the row is deleted later or if all the rows are deleted from the table, that number will not be issued again.


Example

OPEN DATABASE southwind
SELECT syncnum(), recno() FROM example


Products

Recital, Recital Server