Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6541103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:03:47+00:00 2026-05-25T11:03:47+00:00

I was hoping to do something like this: WITH Hello (Name) AS ( INSERT

  • 0

I was hoping to do something like this:

WITH Hello (Name)
AS (
INSERT INTO MyTest
OUTPUT 
  inserted.Name
VALUES ('George')
)
SELECT * FROM Hello

In short, I was hoping the output would simply become the CTE input. Is there a way to fix this?

Two more questions:

  1. Is there a way to construct an empty CTE?
  2. Can a CTE be modified? Can I insert rows after it has been constructed?

UPDATE
I found the answer to my primary question, with the intent of filling a CTE with arbitrary data:

;WITH stuff AS (
  SELECT * FROM ( VALUES
   (123, 1),
   (234, 1),
   (345, 0)
  ) [X](id, pref)
)
SELECT * FROM stuff
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:03:48+00:00Added an answer on May 25, 2026 at 11:03 am

    the two other questions

    1)

    WITH Hello 
    AS (
    select  name
    from sysobjects where 1 =0
    )
    SELECT * FROM Hello --no rows
    

    2)

    -- ***  update  ***
    
    create table testNow(id int)
    insert testNow values(1)
    
    ;WITH Hello 
    AS (select id from testNow)
    
    update Hello set id = 2 -- update cte
    
    SELECT * FROM testNow --table now has value 2
    
    -- ***  insert   ***
    
    ;WITH Hello 
    AS (
    select id from testNow
    
    )
    
    insert Hello values( 3 )
    
    SELECT * FROM testNow --table now has 2 rows
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hoping that using something like this demo it is possible to drag items within
I'm hoping to do something like this: data = read.table(mydata.txt, header=T)[,-1] test<-c(Piggies,Epstein,Majesty,Millionmiles,Mozambique,Deadpool,Blackbird,SamStonev2,Daytripper,Starr,Yellowsubmarine,Harrison,Taxman,Carey,Baez,Finn,Glassonionv2,Weight,Jericho,Monkey,Maggiemae,Cinnamongirl,Walrus,Anna,Handydandy,Pam,Wigwam,Psylocke,Coolwater,Wallflower,Cactustree,Hoist,Baronharkonnen,Coyote,BlueJay,NeilYoung,Harvest,KittyPryde,Beatles,Jam_session,Black_Crow,Carnival,Tombstone_blues,Sun_King,EmmaFrost,Sway,GhanimaAtreides,Heartland,Siona,Percy,Julia,Trouble,Sol_49,C21,Sol_18,i_126,i_114,Sol_6,Sinv_25,Sol_M3,Sol_20,Sol_42f,C316,C204,i_120_PigTail,C234,C368_PigTail,i_135,C1,C121_PigTail,C264,C367,Sinv12,C278_PT,i_125_PT,C485,Jerry_Garcia,C259,i_113,i_127,cassidy_PigTail,Sol_11,Jackstraw_PigTail,st_stephen,red_ant,sunrise,i_109,C216_pigtail,i129) fit1 <-
I'm running into a mental roadblock here and I'm hoping that I'm missing something
I have a sqlite3 query like: SELECT word FROM table WHERE word NOT LIKE
When you use Html5 localStorage values are stored as strings. This is something you
Using the resourcebundle with BV in JSF 2 would look something like this :
I'd like to do something like this, where based on some condition I decide
I want to do something like this: .even { float: left; text-align: left; }
I'm hoping to implement something like all of the great plugins out there for
I have a folder structure like this /img/products/{product name}/ and then the sub folders

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.