Insert into a Temp Table in a CTE
问题 I am trying to insert data into a temp table within a CTE. Here is the Code I am using: Can someone provide a little guidance on why it is not working. Create Table #Clients (HospMastID smallint Null ,HospCode smallint Null ,ClientID smallint Null ,ControlGroup smallint Null); ,Clients as (Insert Into #Clients Select Distinct HospMastID ,HospCode ,ClientID From Final) Thanks, Scott 回答1: Simply, you cannot use the INSERT function inside a CTE. Assuming "Final" was one of the other CTE's in the