I'm trying to populate a table from a sub-query.

CREATE TABLE test
(
ID int
)


INSERT INTO test
VALUES (SELECT [Customer Id] 
FROM   [Customers])

QUESTION:
I know you can do this in ORACLE but Is something like this possible in T-SQL.

I can also write something like this in SQL which achieves the same result but I will lose the datatype,

SELECT [Customer Id] 
INTO test
FROM   [Customers]

Any suggestions is greatly appreciated.

INSERT INTO test
(SELECT [Customer Id] 
FROM   [Customers])

Works fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.