Monday, August 20, 2018

Did you know that you may do an INSERT in T-SQL without specifying the column?

If you just match the number of columns you may insert into this table like so:

INSERT INTO People VALUES (newid(), 'Zella', 'Iowa', 'United States')

 
 

Crazier yet, something I saw at work today had me believing that if one of the columns is an auto-incrementing numeric id that you just leave its value out when you do an insert like this.

No comments:

Post a Comment