I am attempting to write the below query, but the column doesn't exist in photos table so MS SQL is reporting an error
Code:
if exists (select column_name from INFORMATION_SCHEMA.columns where table_name = 'audio' and column_name = 'aud_length')
begin
select * from audio where aud_length = 334
end
if exists (select column_name from INFORMATION_SCHEMA.columns where table_name = 'photos' and column_name = 'aud_length')
begin
select * from photos where aud_length = 334
end