Thursday, August 28, 2014

C# To Check if Field Exists in SQL View


You can execute a sql query:



SELECT 1
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%FieldName%'
and table_name = 'tablename';





Hope that helps

Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.



How would I route in my C# syntax based off the field being there or not being there?

No comments:

Post a Comment