adsense

Saturday, June 26, 2021

SQL Server read XML attribute

Suppose you have a XML value stored in a table


<?xml version="1.0" encoding="utf-8"?>
<rootElement>
  <param name="p1" value="v1" />
  <param name="p2" value="v2" />
  ...
</rootElement>

 

We can get the value of the p1 parameter as follows


SELECT
  columnNAame.value('(/rootElement/param[@name="p1"]/@value)[1]', 'varchar(50)')
FROM  
  tableName

Notice that the correct datatype should be chosen within the query. If we have a integer value we have to use int as the datatype. In addition if long text is stored for the value proper data length needs to be given.

Cheers

Samitha

Sunday, June 13, 2021

Chrome complains about a missing source map

Recently I have added a Javascript library and found that  Chrome devtools keeps complaining about a missing source map

Initially I have referenced the .js fil as follows

<script src="https://cdn.jsdelivr.net/npm/@linways/table-to-excel@1.0.4/dist/tableToExcel.js"></script>

 The resolution was to replace the .js file with .min.js as follows

 <script src="https://cdn.jsdelivr.net/npm/@linways/table-to-excel@1.0.4/dist/tableToExcel.min.js"></script>

 

Cheers

Samitha