Dokument - 02. Artikelhantering - Art. attribut - Teknisk beskrivning

Teknisk beskrivning av attribut

Attribut på artikel består av tre tabeller. LagerAtt, Attribut och AttrGrupp.

 

Tabell Attribut - Attributmallar

 CREATE TABLE [dbo].[ATTRIBUT](

[Atid] [int] IDENTITY(1,1) NOT NULL,
[Attemplateid] [varchar](10) NOT NULL,
[Atattributeid] [varchar](10) NOT NULL,
[Attemplatename] [varchar](50) NOT NULL,
[Atgroupid] [varchar](10) NOT NULL,
[Atattributename] [varchar](50) NOT NULL,
[Atattributesort] [int] NOT NULL,
[Atwebfilter] [bit] NOT NULL,
[Atflag] [varchar](max) NOT NULL,
[Atnote] [varchar](max) NOT NULL,
[Atlastuser] [varchar](10) NOT NULL,
[Atlastdate] [datetime] NOT NULL

)

 

Tabell AttrGroup - Attributgrupper

 

CREATE TABLE [dbo].[ATTRGROUP](

[Agid] [int] IDENTITY(1,1) NOT NULL,
[Agtemplateid] [varchar](10) NOT NULL,
[Aggroupid] [varchar](10) NOT NULL,
[Aggrouptitle] [varchar](100) NOT NULL,
[Aggroupsort] [int] NOT NULL

 

 

Tabell LagerAtt - Artiklars attributdata

 

CREATE TABLE [dbo].[LAGERATT](

[Laid] [int] IDENTITY(1,1) NOT NULL,
[Laitem] [varchar](20) NOT NULL,
[Latemplateid] [varchar](10) NOT NULL,
[Laattributeid] [varchar](10) NOT NULL,
[Lavalue] [varchar](100) NOT NULL,
[Lahide] [varchar](1) NOT NULL,
[Lanote] [varchar](max) NOT NULL,
[Lalastuser] [varchar](10) NOT NULL,
[Lalastdate] [datetime] NOT NULL

)

 

 

SQL-fråga för att lista en artikels attribut och dess rubriker.

SELECT Laid, Latemplateid, Aggrouptitle, Atattributename, Lavalue, Atwebfilter, Lahide, Aggroupsort, Atattributesort, Lalastdate 
FROM LagerAtt
JOIN Attribut ON Latemplateid=Attemplateid And Laattributeid=Atattributeid
JOIN AttrGroup ON Attemplateid=Agtemplateid And Atgroupid=Aggroupid
WHERE Laitem='07-0583'
ORDER BY Aggroupsort,Atattributesort

 

2016-01-13, 2016-02-23