By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
8 rows affected
| TableName | ColumnName | IsInt |
|---|---|---|
| Pricedetails | Not All ints | sellingPrice |
| Pricedetails | Not All ints | RetailPrice |
| Pricedetails | Not All ints | Wholesaleprice |
| Itemdetails | All ints | ItemID |
| Itemdetails | Not All ints | ItemPrice |
SELECT
TableName = 'Pricedetails',
ColumnName,
IsInt
FROM (
SELECT
[sellingPrice] = CASE WHEN COUNT(CASE WHEN ROUND([sellingPrice], 0) <> [sellingPrice] THEN 1 END) = 0 THEN 'All ints' ELSE 'Not All ints' END,
[RetailPrice] = CASE WHEN COUNT(CASE WHEN ROUND([RetailPrice], 0) <> [RetailPrice] THEN 1 END) = 0 THEN 'All ints' ELSE 'Not All ints' END,
[Wholesaleprice] = CASE WHEN COUNT(CASE WHEN ROUND([Wholesaleprice], 0) <> [Wholesaleprice] THEN 1 END) = 0 THEN 'All ints' ELSE 'Not All ints' END
FROM [Pricedetails]
) t
UNPIVOT (
ColumnName FOR IsInt IN (
[sellingPrice], [RetailPrice], [Wholesaleprice]
)
) u
UNION ALL
SELECT
TableName = 'Itemdetails',
ColumnName,
IsInt
FROM (
SELECT
[ItemID] = CASE WHEN COUNT(CASE WHEN ROUND([ItemID], 0) <> [ItemID] THEN 1 END) = 0 THEN 'All ints' ELSE 'Not All ints' END,
[ItemPrice] = CASE WHEN COUNT(CASE WHEN ROUND([ItemPrice], 0) <> [ItemPrice] THEN 1 END) = 0 THEN 'All ints' ELSE 'Not All ints' END
FROM [Itemdetails]
) t
UNPIVOT (
ColumnName FOR IsInt IN (
[ItemID], [ItemPrice]
)
) u
Warning: Null value is eliminated by an aggregate or other SET operation.