1

Topic: Lost WACA-Sch5_sect9.1

I think I'm doing something wrong but can't see what. This code creates all preferred taxa;

Drop table TX_All_Preferred
SELECT     NBNData.dbo.TAXON_LIST.ITEM_NAME AS CheckList, NBNData.dbo.TAXON.ITEM_NAME,
                      CAST(NBNData.dbo.ufn_GetDesignations(NBNData.dbo.TAXON_LIST_ITEM.TAXON_LIST_ITEM_KEY, 1, 'SR00036300000001', NULL) AS nVarchar(254))
                      AS All_Designated, NBNData.dbo.TAXON_LIST.PREFERRED
INTO         TX_All_Preferred
FROM         NBNData.dbo.TAXON_LIST INNER JOIN
                      NBNData.dbo.TAXON_LIST_VERSION ON NBNData.dbo.TAXON_LIST.TAXON_LIST_KEY = NBNData.dbo.TAXON_LIST_VERSION.TAXON_LIST_KEY INNER JOIN
                      NBNData.dbo.TAXON_LIST_ITEM ON
                      NBNData.dbo.TAXON_LIST_VERSION.TAXON_LIST_VERSION_KEY = NBNData.dbo.TAXON_LIST_ITEM.TAXON_LIST_VERSION_KEY INNER JOIN
                      NBNData.dbo.TAXON_VERSION ON NBNData.dbo.TAXON_LIST_ITEM.TAXON_VERSION_KEY = NBNData.dbo.TAXON_VERSION.TAXON_VERSION_KEY INNER JOIN
                      NBNData.dbo.TAXON ON NBNData.dbo.TAXON_VERSION.TAXON_KEY = NBNData.dbo.TAXON.TAXON_KEY
WHERE     (NBNData.dbo.TAXON_LIST.PREFERRED = 1)

It uses a taxon designation set ['SR00036300000001'] I created which has the correct designations in it;
Title                          Taxon_Designation_Set_Key Taxon_Designation_Type_Key SHORT_NAME
SERC Data Supply    SR00036300000001           NBNSYS0000000009                   WACA-Sch5_sect9.1(kill/injuring)
SERC Data Supply    SR00036300000001           NBNSYS0000000010                   WACA-Sch5_sect9.1(taking)

When I use;
SELECT
  FROM [NBNExtension].[dbo].[TX_All_Preferred]
  WHERE CHARINDEX('9.1',All_Designated,1)>0

I get nothing returned. Obviously I tried "WACA-Sch5_sect9.1(kill/injuring)" and "WACA-Sch5_sect9.1" first, but it returned no values. I'm performing the same exercise on 15-20 designations and they are all returning results but no WACA-Sch5_sect9.1(kill/injuring) or WACA-Sch5_sect9.1(taking).

I understand that WACA-Sch5_sect9.1(kill/injuring) is now WACA-Sch5_sect9.1a and WACA-Sch5_sect9.1(taking) is now WACA-Sch5_sect9.1b but this does not seem to have been changed in Recorder. Though I noticed that "England_NERC_S41" changed from "England NERC S41" in the last updates I did and this had consequences since I refer to these names explicitly in All_Designations.

So if any of you can spot my error I would much appreciate it.

Data Manger
Somerset Environmental Records Centre

2

Re: Lost WACA-Sch5_sect9.1

I am also getting no results for 9.1a or 9.1b, using the report wizard so I don't think it's your code. Does this thread explain it?
https://forums.nbn.org.uk/viewtopic.php?id=6759

I.e. are we waiting on a dictionary update for this to work?

---

As an aside rather than CHARINDEX, I use a boolean and separate columns for each designation, populating it with e.g.

dbo.ufn_getdesignations('NHMSYS0021132544',5,null,'NBNSYS0000000011')

Then do something along the lines of:

SELECT
  FROM [NBNExtension].[dbo].[TX_All_Preferred]
  WHERE IS_WACA_9_1 = 'Yes'

which would mean that any changes in names or terminology wouldn't require a change in code.

Charlie Barnes
Information Officer
Greater Lincolnshire Nature Partnership

3 (edited by TonyP 28-11-2017 11:28:27)

Re: Lost WACA-Sch5_sect9.1

Thanks Charlie, I was thinking I'd have to refer to the keys at some point as I'd not expected the labels to change. You've saved me the time of thinking about it.

Horrified that JNCC do not seem to care about protected species! We've processed over 35,000 planning applications that may have failed inclusion of these species. Consultancies would not have known of consequences either. For the want of a nail....

Data Manger
Somerset Environmental Records Centre