Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a SQL "pseudocolumn"?

I accidentally coded SELECT $FOO.. and got the error "Invalid pseudocolumn "$FOO".

I can't find any documentation for them. Is it something I should know?

Edit: this is a MS SQL Server specific question.

like image 463
Corey Trager Avatar asked Oct 12 '08 14:10

Corey Trager


People also ask

What is a Pseudocolumn in SQL?

A pseudocolumn behaves like a table column, but is not actually stored in the table. You can select from pseudocolumns, but you cannot insert, update, or delete their values. A pseudocolumn is also similar to a function without arguments (refer to Chapter 7, "Functions").

What is pseudo code SQL?

Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented. These include while, do, for, if, switch.

What are pseudo columns in mysql?

Pseudocolumn: A pseudo-column behaves like a table column but is not actually stored in the table. You can select from pseudo-columns, but you cannot insert, update, or delete their values. A pseudo-column is also similar to a function without arguments. This section describes these pseudo-columns: CURRVAL and NEXTVAL.


2 Answers

Pseudocolumns are symbolic aliases for actual columns, that have special properties, for example, $IDENTITY is an alias for the column that has the IDENTITY assigned, $ROWGUID for the column with ROWGUIDCOL assigned. It's used for the internal plumbing scripts.

like image 87
Robson Rocha de Araujo Avatar answered Sep 22 '22 17:09

Robson Rocha de Araujo


I don't know why most of the answers are Oracle specific the Question is about SQL Server!

As well as RobsonROX's answer an other example of their use is in the output clause of a merge statement. $action indicates whether the row was inserted or deleted.

like image 45
Martin Smith Avatar answered Sep 22 '22 17:09

Martin Smith