Code Analysis

BP005

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, which may not last. Also, results should always consist of just the columns you need.

Available in

SQL Prompt

SQL Code Guard

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


Didn't find what you were looking for?