sql - Overwrite ONE column in select statement with a fixed value without listing all columns -
i have number of tables large number of columns (> 100) in sql server database. in cases when selecting (using views) need replace 1 of columns fixed result value instead of data row(s). there way use
select table.*, 'value' column1 table
if column1 column name within table?
of course can list columns expected result in select statement, replacing 1 value. however, inconvinient , having 3 or 4 views have maintain them if columns added or removed table.
nope, have specify columns in case.
, have more serious problems if tables being changed often. may signal of large architectural defects.
anyway, listing columns instead of *
practice, because if columns number will change, may cause cascade errors.
Comments
Post a Comment