
CREATE VIEW [dbo].[SPICE_Taxon_VIEW]
AS
SELECT     dbo.PTaxon.RIdentifier AS TaxonId, dbo.PTaxon.PTRefFk, dbo.PTaxon.PTNameFk, dbo.PTaxon.StatusFk, 
                      dbo.f_species2000_getStatus(dbo.PTaxon.RIdentifier) AS Status, dbo.Name.RankFk, dbo.Rank.Rank, dbo.Name.NameCache, 
                      dbo.f_species2000_getAuthorString(dbo.Name.NameId) AS FullAuthorCache, 
                      'FullSpeciesAuthorCache' = CASE WHEN rankfk > 60 THEN NULL ELSE dbo.f_species2000_getAuthorString(dbo.Name.NameId) END, 
                      dbo.f_species2000_getFamily(dbo.PTaxon.RIdentifier) AS Family, dbo.Name.SupragenericName, dbo.Name.Genus, dbo.Name.SpeciesEpi, 
                      dbo.Name.InfraSpeciesEpi, dbo.Rank.RankAbbrev, dbo.Name.NomRefFk, dbo.Name.NomRefDetailFk, 
                      dbo.f_species2000_getAcceptedSpeciesID(dbo.PTaxon.RIdentifier) AS AccTaxonFk
FROM         dbo.Name INNER JOIN
                      dbo.PTaxon ON dbo.Name.NameId = dbo.PTaxon.PTNameFk INNER JOIN
                      dbo.Rank ON dbo.Name.RankFk = dbo.Rank.RankId


GO
