I have the following code where I create a table and I want to insert information that came out of a query:
CREATE TABLE AR_TABLA_REORI (TER VARCHAR(50),REG VARCHAR(50),ORIGEN INT, CLIENTES INT, TOTAL INT,SUCORIGEN INT)
INSERT INTO AR_TABLA_REORI VALUES (TER ,REG ,ORIGEN ,CLIENTES )
SELECT TERL,REG,ORIGEN, COUNT(*) AS SUCORIGEN
FROM CLIENTES_TBL
Data types in table CLIENTES_TBL
TER nvarchar(510)
REG nvarchar(510)
ORIGEN INT
CLIENTES INT
I have the following error:
The name "TER" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.