September 11, 2013 at 4:00 am
I want to check field/column exist or not in a table and populate the value
Example: Does the column1,column2 exists:
case1:return column1 and column2
case2:return column1 or column2
case3:return column1
case4:return column2
case5:return '0'(no columns)
How can I achieve this?
September 11, 2013 at 4:17 am
Your explanation is not very clear enough. What do you mean by return( return a value or a result or a column name or ... )?
You can use the INFORMATION_SCHEMA.COLUMNS view to check if a particular column exists in a table.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
September 24, 2013 at 12:16 am
tibco29 (9/11/2013)
I want to check field/column exist or not in a table and populate the valueExample: Does the column1,column2 exists:
case1:return column1 and column2
case2:return column1 or column2
case3:return column1
case4:return column2
case5:return '0'(no columns)
How can I achieve this?
I think what you mean is: If column1 exists then populate column1 with a particular value else ignore. Right?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply