I'm using sql server 2008 r2, I have my_table
containing my_col
of type text
which contains xml
, I want to select an attribute from the root element of that xml and convert it to a bit
type (the attribute takes the value 'true'/'false') when I select a particular row from the table, rather than selecting out the whole string and passing it back to the server as its quite a long string and I could be selecting many rows at a time. I'm not too good with regex or sql. Here is the format of my text/xml column:
<rootElementName <!--lots of attributes--> Recommended="false"><!--...lots of stuff in here...--></rootElementName>
I just want to select out 0
for rows that have Recommended="false"
and 1
for Recommended="true"
.