Hi @SQL9 ,
Thank you for asking this question. Try the following statements.
Hope this helps. If it does, please don't forget to "accept the answer" and "up-vote"! Thank you!
create table SQLData
(
ID int null , TableName varchar(100) null , SQLText Varchar(max) null
)
insert into SQLData (ID , TableName , SQLText)
Values
(1 , '[dbo].Customer' , concat((Select count(customeraddress1) from [dbo].Customer where customeraddress1 is not null), ' Select count(customeraddress1) from [dbo].Customer where customeraddress1 is not null')),
(2 , '[dbo].Customer' , concat((Select count(customeraddress2) from [dbo].Customer where customeraddress2 is not null), ' Select count(customeraddress2) from [dbo].Customer where customeraddress2 is not null')),
(3 , '[dbo].Customer' , concat((Select count(customeraddress3) from [dbo].Customer where customeraddress3 is not null), ' Select count(customeraddress3) from [dbo].Customer where customeraddress3 is not null')),
(4 , '[dbo].Product' , concat((Select count(ProductDescription) from [dbo].Product where ProductDescription is not null), ' Select count(ProductDescription) from [dbo].Product where ProductDescription is not null')),
(5 , '[dbo].Product' , concat((Select count(Discount) from [dbo].Product where Discount is not null), ' Select count(Discount) from [dbo].Product where Discount is not null'))
Select * from SQLData