What is the equivalent of the Oracle "Dual" table in MS SqlServer?
This is my Select
:
SELECT pCliente, 'xxx.x.xxx.xx' AS Servidor, xxxx AS Extension, xxxx AS Grupo, xxxx AS Puerto FROM DUAL;
In SQL Server DUAL table does not exist, but you could create one. The DUAL table was created by Charles Weiss of Oracle corporation to provide a table for joining in internal views.
It is a table that is automatically created by Oracle Database along with the data dictionary. DUAL is in the schema of the user SYS but is accessible by the name DUAL to all users. It has one column, DUMMY, defined to be VARCHAR2(1), and contains one row with a value X.
The DUAL table is a dummy table in Oracle databases. It's used for selecting data from system functions and calculations when you don't need any data from the database.
The DUMMY table is provided as a table that always has exactly one row. This can be useful for extracting information from the database, as in the following example that gets the current user ID and the current date from the database. The DUMMY table is a SQL Anywhere system table.
In sql-server
, there is no dual
you can simply do
SELECT pCliente, 'xxx.x.xxx.xx' AS Servidor, xxxx AS Extension, xxxx AS Grupo, xxxx AS Puerto
However, if your problem is because you transfered some code from Oracle
which reference to dual
you can re-create the table :
CREATE TABLE DUAL ( DUMMY VARCHAR(1) ) GO INSERT INTO DUAL (DUMMY) VALUES ('X') GO
You do not need DUAL in mssql server
in oracle
select 'sample' from dual
is equal to
SELECT 'sample'
in sql server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With