Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE ProductType (
- Id int primary key,
- NamePhraseId int, -- link to the Phrase containing the name of this product type.
- DescriptionPhraseId int
- )
- CREATE TABLE LocalizedPhrase (
- PhraseId int primary key,
- CultureCode varchar(8) primary key,
- Content nvarchar(255) -- the actual localized content
- )
- CREATE TABLE GenderedLocalizedPhrase (
- PhraseId int primary key,
- CultureCode varchar(8) primary key,
- GenderCode char(1) primary key, -- 'm', 'f' or '?' - links to Gender table
- Content nvarchar(255)
- )
- -- assume @MyCulture contains the culture code ('ca-FR') that we are looking for:
- SELECT
- Product.Id,
- Product.Name,
- COALESCE(ProductStatusLocalizedPhrase.Content, ProductStatusPhrase.Content) as ProductStatus,
- COALESCE(ProductTypeLocalizedPhrase.Content, ProductTypePhrase.Content) as ProductType,
- FROM Product
- INNER JOIN ProductStatus ON Product.StatusId = ProductStatus.Id
- INNER JOIN Phrase as ProductStatusPhrase ON ProductStatus.NamePhraseId = Phrase.Id
- LEFT JOIN LocalizedPhrase as ProductStatusLocalizedPhrase
- ON ProductStatus.NamePhraseId = ProductStatusLocalizedPhrase.Id and CultureCode = @MyCulture
- INNER JOIN ProductType ON Product.TypeId = ProductType.Id
- INNER JOIN Phrase as ProductTypePhrase ON ProductType.NamePhraseId = Phrase.Id
- LEFT JOIN LocalizedPhrase as ProductTypeLocalizedPhrase
- ON ProductType.NamePhraseId = ProductTypeLocalizedPhrase.Id and CultureCode = @MyCulture
Add Comment
Please, Sign In to add comment