SQL Server – Copy data from one table to another

To copy data from one table to an existing table, use INSERT INTO SELECT and specify the column list: If the columns are the exact same in the two tables (and there are no identity columns), you don’t need to specify the column list: When the table doesn’t exist, use SELECT INTO, specifying which columns … Read more

SQL – Select from information_schema.columns

You can query the information_schema.columns system view to get information about all columns in the database. Here’s an example: Here’s the first few rows this returns: TABLE_NAME COLUMN_NAME Movies Id Movies Title Movies Year In this article, I’ll show more examples of querying information_schema.columns. Get columns filtered by name Let’s say you want to find … Read more