TOAD SQL SERVER subset table error

Hi,

I can run this simple query as a select statement but when I go to run it out into a subset (create table) below I get this error.

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ‘(’

Any idea what I am doing wrong?

Thanks

WHP

SELECT a.MEMB_BID as “PROF OTH MEM BID”
,a.CPT_AND_HCPCS_CD as “Procedure Code”
,COUNT (a.CPT_AND_HCPCS_CD) as “Count of Procedures from PROFOTHER”

FROM RiskAdjust_BHI.dbo.PROFOTHER a

WHERE a.CPT_AND_HCPCS_CD in (‘H0002’,‘H0012’,‘H0013’,‘H2001’,‘H2035’,‘H2036’,‘S0315’,‘S0316’,‘S0317’,‘S0320’,‘S0340’,‘S0341’,
‘S0342’,‘S9140’,‘S9141’,‘S9455’,‘S9460’,‘S9465’,‘S9470’,‘S9472’,‘S9473’,‘S9476’,‘T1023’,‘4242F’,
‘4500F’,‘H0018’,‘H0028’,‘H0037’)

GROUP BY a.MEMB_BID, a.CPT_AND_HCPCS_CD
ORDER BY a.MEMB_BID, a.CPT_AND_HCPCS_CD;

Create Table RiskAdjust_Temp.dbo.WHP_CPP_PROF as
(SELECT a.MEMB_BID as “PROF OTH MEM BID”
,a.CPT_AND_HCPCS_CD as “Procedure Code”
,COUNT (a.CPT_AND_HCPCS_CD) as “Count of Procedures from PROFOTHER”

FROM RiskAdjust_BHI.dbo.PROFOTHER a

WHERE a.CPT_AND_HCPCS_CD in (‘H0002’,‘H0012’,‘H0013’,‘H2001’,‘H2035’,‘H2036’,‘S0315’,‘S0316’,‘S0317’,‘S0320’,‘S0340’,‘S0341’,
‘S0342’,‘S9140’,‘S9141’,‘S9455’,‘S9460’,‘S9465’,‘S9470’,‘S9472’,‘S9473’,‘S9476’,‘T1023’,‘4242F’,
‘4500F’,‘H0018’,‘H0028’,‘H0037’));

I got it.

I need to do a “select into”

SELECT

a.MEMB_BID as “PROF OTH MEM BID”

,a.CPT_AND_HCPCS_CD as “Procedure Code”

,COUNT (a.CPT_AND_HCPCS_CD) as “Count of Procedures from PROFOTHER”

INTO RiskAdjust_Temp.dbo.WHP_CPP_PROF

Thanks

WHP

Coming from Teradata, which is fairly ANSI-compliant, T-SQL is a bit of a change.

At least it’s not PL-SQL…

Ducks