Skip to main content

Timeline for How to insert into TABLE Variable?

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Jan 19, 2018 at 13:05 comment added Simon Hellings @AndriyM thanks for clearing that up :) So easy to misinterpret something that is written.
Jan 19, 2018 at 13:01 comment added Andriy M @SimonHellings: I was commenting specifically on the NOT NULL point raised by Edgar. (Although I have since been slightly corrected on that as well, because apparently the default nullability of columns can be controlled through SET ANSI_NULL_DFLT_OFF and SET ANSI_NULL_DFLT_ON). Regarding the syntax, yes, you are perfectly correct, when you are not specifying target columns in INSERT, you must supply values for all writeable columns of the target table.
Jan 19, 2018 at 11:58 comment added Simon Hellings @AndriyM, are you sure? If using insert and not specifying the columns, trying to {insert @x select y} will result in a "Column name or number of supplied values does not match table definition" error.
Jan 19, 2018 at 8:58 comment added Andriy M You created 4 column with NOT NULL behaviors – actually they didn't. None of the columns is declared with an explicit NULL or NOT NULL, which makes the former the default, so all columns are nullable and there will be no error. I'm not sure why two sets of columns but maybe that's part of the problem (how to populate two sets of columns from two rows)
Jan 19, 2018 at 8:58 vote accept Gour Gopal
Jan 19, 2018 at 8:51 history edited Edgar Allan Bayron CC BY-SA 3.0
deleted 8 characters in body
Jan 19, 2018 at 8:44 history answered Edgar Allan Bayron CC BY-SA 3.0