BP005
Published 16 November 2017
Asterisk in select list
There is an asterisk instead of a column list in a SELECT statement.
SELECT * FROM in IF EXISTS statements are fine, but SELECT * in other contexts assumes certain columns in a particular order. For index and performance tuning, results should always consist of just the columns you need.
Using SELECT * FROM within IF EXISTS statements are fine, but in other contexts it causes several problems. For example, INSERT INTO…SELECT * FROM statement assumes the columns are in a particular order, and that order may not last. Also, selecting all the columns in a table when you don’t need them all can cause unnecessary network load and query performance problems.
Learn more about this code smell - Finding code smells using SQL Prompt: Asterisk in SELECT list