what’s the best way to form my sql so it will return a bool into a c# variable? Or is just easier to inspect the scalar value on the return of an .ExecuteScalar function?
Basically, want to know if row exists or not.
select COUNT(COLUMN_NAME) from INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='Customers'
AND
COLUMN_NAME = 'birthdate'
AND
DATA_TYPE = 'datetime'
for example, if the row exists above return true.
You can use a CASE check on the result of the COUNT() to force 0 or 1:
This will return 0 or 1