Created
April 4, 2012 20:49
-
-
Save jasonamyers/2305496 to your computer and use it in GitHub Desktop.
MS CRM - Create Query to have an unsecured FilteredAccount view called FilteredAccountUS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create view [dbo].[FilteredAccountUS] ( | |
accountcategorycode, | |
accountcategorycodename, | |
accountclassificationcode, | |
accountclassificationcodename, | |
accountid, | |
accountnumber, | |
accountratingcode, | |
accountratingcodename, | |
address1_addressid, | |
address1_addresstypecode, | |
address1_addresstypecodename, | |
address1_city, | |
address1_country, | |
address1_county, | |
address1_fax, | |
address1_freighttermscode, | |
address1_freighttermscodename, | |
address1_latitude, | |
address1_line1, | |
address1_line2, | |
address1_line3, | |
address1_longitude, | |
address1_name, | |
address1_postalcode, | |
address1_postofficebox, | |
address1_primarycontactname, | |
address1_shippingmethodcode, | |
address1_shippingmethodcodename, | |
address1_stateorprovince, | |
address1_telephone1, | |
address1_telephone2, | |
address1_telephone3, | |
address1_upszone, | |
address1_utcoffset, | |
address2_addressid, | |
address2_addresstypecode, | |
address2_addresstypecodename, | |
address2_city, | |
address2_country, | |
address2_county, | |
address2_fax, | |
address2_freighttermscode, | |
address2_freighttermscodename, | |
address2_latitude, | |
address2_line1, | |
address2_line2, | |
address2_line3, | |
address2_longitude, | |
address2_name, | |
address2_postalcode, | |
address2_postofficebox, | |
address2_primarycontactname, | |
address2_shippingmethodcode, | |
address2_shippingmethodcodename, | |
address2_stateorprovince, | |
address2_telephone1, | |
address2_telephone2, | |
address2_telephone3, | |
address2_upszone, | |
address2_utcoffset, | |
aging30, | |
aging30_base, | |
aging60, | |
aging60_base, | |
aging90, | |
aging90_base, | |
businesstypecode, | |
businesstypecodename, | |
ccs_adminasstid, | |
ccs_adminasstiddsc, | |
ccs_adminasstidname, | |
ccs_adminasstidyominame, | |
ccs_contractexpdate, | |
ccs_contractexpdateutc, | |
ccs_contractrenewalsavailablenumberandlength, | |
ccs_contractriskparameters, | |
ccs_currentcontractonfile2, | |
ccs_currentcontractonfile2name, | |
ccs_hsaid, | |
ccs_hsaiddsc, | |
ccs_hsaidname, | |
ccs_hsaidyominame, | |
ccs_inmatecount, | |
ccs_priorhistoryofcontracting, | |
ccs_purchasingregistrationinformation, | |
ccs_regionalmanagerid, | |
ccs_regionalmanageriddsc, | |
ccs_regionalmanageridname, | |
ccs_regionalmanageridyominame, | |
ccs_staffingdetails, | |
ccs_vendorregistrationneeded, | |
ccs_vendorregistrationneededname, | |
ccs_vendorregistrationpasscode, | |
ccs_vendorregistrationusername, | |
ccs_vendorregistrationwebsite, | |
createdby, | |
createdbydsc, | |
createdbyname, | |
createdbyyominame, | |
createdon, | |
createdonutc, | |
creditlimit, | |
creditlimit_base, | |
creditonhold, | |
creditonholdname, | |
customersizecode, | |
customersizecodename, | |
customertypecode, | |
customertypecodename, | |
defaultpricelevelid, | |
defaultpriceleveliddsc, | |
defaultpricelevelidname, | |
description, | |
donotbulkemail, | |
donotbulkemailname, | |
donotbulkpostalmail, | |
donotbulkpostalmailname, | |
donotemail, | |
donotemailname, | |
donotfax, | |
donotfaxname, | |
donotphone, | |
donotphonename, | |
donotpostalmail, | |
donotpostalmailname, | |
donotsendmarketingmaterialname, | |
donotsendmm, | |
emailaddress1, | |
emailaddress2, | |
emailaddress3, | |
exchangerate, | |
fax, | |
ftpsiteurl, | |
importsequencenumber, | |
industrycode, | |
industrycodename, | |
isprivatename, | |
lastusedincampaign, | |
lastusedincampaignutc, | |
lbmc_currentproviderid, | |
lbmc_currentprovideriddsc, | |
lbmc_currentprovideridname, | |
lbmc_currentprovideridyominame, | |
lbmc_maximumexpirationdate, | |
lbmc_maximumexpirationdateutc, | |
marketcap, | |
marketcap_base, | |
masteraccountiddsc, | |
masteraccountidname, | |
masteraccountidyominame, | |
masterid, | |
merged, | |
mergedname, | |
modifiedby, | |
modifiedbydsc, | |
modifiedbyname, | |
modifiedbyyominame, | |
modifiedon, | |
modifiedonutc, | |
name, | |
numberofemployees, | |
originatingleadid, | |
originatingleadiddsc, | |
originatingleadidname, | |
originatingleadidyominame, | |
overriddencreatedon, | |
overriddencreatedonutc, | |
ownerid, | |
owneriddsc, | |
owneridname, | |
owneridtype, | |
owneridyominame, | |
ownershipcode, | |
ownershipcodename, | |
owningbusinessunit, | |
owningteam, | |
owninguser, | |
parentaccountid, | |
parentaccountiddsc, | |
parentaccountidname, | |
parentaccountidyominame, | |
participatesinworkflow, | |
participatesinworkflowname, | |
paymenttermscode, | |
paymenttermscodename, | |
preferredappointmentdaycode, | |
preferredappointmentdaycodename, | |
preferredappointmenttimecode, | |
preferredappointmenttimecodename, | |
preferredcontactmethodcode, | |
preferredcontactmethodcodename, | |
preferredequipmentid, | |
preferredequipmentiddsc, | |
preferredequipmentidname, | |
preferredserviceid, | |
preferredserviceiddsc, | |
preferredserviceidname, | |
preferredsystemuserid, | |
preferredsystemuseriddsc, | |
preferredsystemuseridname, | |
preferredsystemuseridyominame, | |
primarycontactid, | |
primarycontactiddsc, | |
primarycontactidname, | |
primarycontactidyominame, | |
revenue, | |
revenue_base, | |
sharesoutstanding, | |
shippingmethodcode, | |
shippingmethodcodename, | |
sic, | |
statecode, | |
statecodename, | |
statuscode, | |
statuscodename, | |
stockexchange, | |
telephone1, | |
telephone2, | |
telephone3, | |
territorycode, | |
territorycodename, | |
territoryid, | |
territoryiddsc, | |
territoryidname, | |
tickersymbol, | |
timezoneruleversionnumber, | |
transactioncurrencyid, | |
transactioncurrencyiddsc, | |
transactioncurrencyidname, | |
utcconversiontimezonecode, | |
websiteurl, | |
yominame, | |
crm_moneyformatstring | |
) with view_metadata as | |
select | |
Account.AccountCategoryCode, | |
AccountCategoryCodePLTable.Value, | |
Account.AccountClassificationCode, | |
AccountClassificationCodePLTable.Value, | |
Account.AccountId, | |
Account.AccountNumber, | |
Account.AccountRatingCode, | |
AccountRatingCodePLTable.Value, | |
Account.Address1_AddressId, | |
Account.Address1_AddressTypeCode, | |
Address1_AddressTypeCodePLTable.Value, | |
Account.Address1_City, | |
Account.Address1_Country, | |
Account.Address1_County, | |
Account.Address1_Fax, | |
Account.Address1_FreightTermsCode, | |
Address1_FreightTermsCodePLTable.Value, | |
Account.Address1_Latitude, | |
Account.Address1_Line1, | |
Account.Address1_Line2, | |
Account.Address1_Line3, | |
Account.Address1_Longitude, | |
Account.Address1_Name, | |
Account.Address1_PostalCode, | |
Account.Address1_PostOfficeBox, | |
Account.Address1_PrimaryContactName, | |
Account.Address1_ShippingMethodCode, | |
Address1_ShippingMethodCodePLTable.Value, | |
Account.Address1_StateOrProvince, | |
Account.Address1_Telephone1, | |
Account.Address1_Telephone2, | |
Account.Address1_Telephone3, | |
Account.Address1_UPSZone, | |
Account.Address1_UTCOffset, | |
Account.Address2_AddressId, | |
Account.Address2_AddressTypeCode, | |
Address2_AddressTypeCodePLTable.Value, | |
Account.Address2_City, | |
Account.Address2_Country, | |
Account.Address2_County, | |
Account.Address2_Fax, | |
Account.Address2_FreightTermsCode, | |
Address2_FreightTermsCodePLTable.Value, | |
Account.Address2_Latitude, | |
Account.Address2_Line1, | |
Account.Address2_Line2, | |
Account.Address2_Line3, | |
Account.Address2_Longitude, | |
Account.Address2_Name, | |
Account.Address2_PostalCode, | |
Account.Address2_PostOfficeBox, | |
Account.Address2_PrimaryContactName, | |
Account.Address2_ShippingMethodCode, | |
Address2_ShippingMethodCodePLTable.Value, | |
Account.Address2_StateOrProvince, | |
Account.Address2_Telephone1, | |
Account.Address2_Telephone2, | |
Account.Address2_Telephone3, | |
Account.Address2_UPSZone, | |
Account.Address2_UTCOffset, | |
Account.Aging30, | |
Account.Aging30_Base, | |
Account.Aging60, | |
Account.Aging60_Base, | |
Account.Aging90, | |
Account.Aging90_Base, | |
Account.BusinessTypeCode, | |
BusinessTypeCodePLTable.Value, | |
Account.CCS_AdminAsstId, | |
Account.CCS_AdminAsstIdDsc, | |
Account.CCS_AdminAsstIdName, | |
Account.CCS_AdminAsstIdYomiName, | |
dbo.fn_UTCToTzSpecificLocalTime(Account.CCS_ContractExpDate, | |
us.TimeZoneBias, | |
us.TimeZoneDaylightBias, | |
us.TimeZoneDaylightYear, | |
us.TimeZoneDaylightMonth, | |
us.TimeZoneDaylightDay, | |
us.TimeZoneDaylightHour, | |
us.TimeZoneDaylightMinute, | |
us.TimeZoneDaylightSecond, | |
0, | |
us.TimeZoneDaylightDayOfWeek, | |
us.TimeZoneStandardBias, | |
us.TimeZoneStandardYear, | |
us.TimeZoneStandardMonth, | |
us.TimeZoneStandardDay, | |
us.TimeZoneStandardHour, | |
us.TimeZoneStandardMinute, | |
us.TimeZoneStandardSecond, | |
0, | |
us.TimeZoneStandardDayOfWeek), | |
Account.CCS_ContractExpDate, | |
Account.CCS_ContractRenewalsAvailablenumberandlength, | |
Account.CCS_ContractRiskParameters, | |
Account.CCS_CurrentContractonFile2, | |
CCS_CurrentContractonFile2PLTable.Value, | |
Account.CCS_HSAId, | |
Account.CCS_HSAIdDsc, | |
Account.CCS_HSAIdName, | |
Account.CCS_HSAIdYomiName, | |
Account.CCS_Inmatecount, | |
Account.CCS_PriorHistoryofContracting, | |
Account.CCS_PurchasingRegistrationInformation, | |
Account.CCS_RegionalManagerId, | |
Account.CCS_RegionalManagerIdDsc, | |
Account.CCS_RegionalManagerIdName, | |
Account.CCS_RegionalManagerIdYomiName, | |
Account.CCS_StaffingDetails, | |
Account.CCS_VendorRegistrationNeeded, | |
CCS_VendorRegistrationNeededPLTable.Value, | |
Account.CCS_VendorRegistrationPasscode, | |
Account.CCS_VendorRegistrationUsername, | |
Account.CCS_VendorRegistrationWebsite, | |
Account.CreatedBy, | |
Account.CreatedByDsc, | |
Account.CreatedByName, | |
Account.CreatedByYomiName, | |
dbo.fn_UTCToTzSpecificLocalTime(Account.CreatedOn, | |
us.TimeZoneBias, | |
us.TimeZoneDaylightBias, | |
us.TimeZoneDaylightYear, | |
us.TimeZoneDaylightMonth, | |
us.TimeZoneDaylightDay, | |
us.TimeZoneDaylightHour, | |
us.TimeZoneDaylightMinute, | |
us.TimeZoneDaylightSecond, | |
0, | |
us.TimeZoneDaylightDayOfWeek, | |
us.TimeZoneStandardBias, | |
us.TimeZoneStandardYear, | |
us.TimeZoneStandardMonth, | |
us.TimeZoneStandardDay, | |
us.TimeZoneStandardHour, | |
us.TimeZoneStandardMinute, | |
us.TimeZoneStandardSecond, | |
0, | |
us.TimeZoneStandardDayOfWeek), | |
Account.CreatedOn, | |
Account.CreditLimit, | |
Account.CreditLimit_Base, | |
Account.CreditOnHold, | |
CreditOnHoldPLTable.Value, | |
Account.CustomerSizeCode, | |
CustomerSizeCodePLTable.Value, | |
Account.CustomerTypeCode, | |
CustomerTypeCodePLTable.Value, | |
Account.DefaultPriceLevelId, | |
Account.DefaultPriceLevelIdDsc, | |
Account.DefaultPriceLevelIdName, | |
Account.Description, | |
Account.DoNotBulkEMail, | |
DoNotBulkEMailPLTable.Value, | |
Account.DoNotBulkPostalMail, | |
DoNotBulkPostalMailPLTable.Value, | |
Account.DoNotEMail, | |
DoNotEMailPLTable.Value, | |
Account.DoNotFax, | |
DoNotFaxPLTable.Value, | |
Account.DoNotPhone, | |
DoNotPhonePLTable.Value, | |
Account.DoNotPostalMail, | |
DoNotPostalMailPLTable.Value, | |
DoNotSendMMPLTable.Value, | |
Account.DoNotSendMM, | |
Account.EMailAddress1, | |
Account.EMailAddress2, | |
Account.EMailAddress3, | |
Account.ExchangeRate, | |
Account.Fax, | |
Account.FtpSiteURL, | |
Account.ImportSequenceNumber, | |
Account.IndustryCode, | |
IndustryCodePLTable.Value, | |
IsPrivatePLTable.Value, | |
dbo.fn_UTCToTzSpecificLocalTime(Account.LastUsedInCampaign, | |
us.TimeZoneBias, | |
us.TimeZoneDaylightBias, | |
us.TimeZoneDaylightYear, | |
us.TimeZoneDaylightMonth, | |
us.TimeZoneDaylightDay, | |
us.TimeZoneDaylightHour, | |
us.TimeZoneDaylightMinute, | |
us.TimeZoneDaylightSecond, | |
0, | |
us.TimeZoneDaylightDayOfWeek, | |
us.TimeZoneStandardBias, | |
us.TimeZoneStandardYear, | |
us.TimeZoneStandardMonth, | |
us.TimeZoneStandardDay, | |
us.TimeZoneStandardHour, | |
us.TimeZoneStandardMinute, | |
us.TimeZoneStandardSecond, | |
0, | |
us.TimeZoneStandardDayOfWeek), | |
Account.LastUsedInCampaign, | |
Account.LBMC_CurrentProviderId, | |
Account.LBMC_CurrentProviderIdDsc, | |
Account.LBMC_CurrentProviderIdName, | |
Account.LBMC_CurrentProviderIdYomiName, | |
dbo.fn_UTCToTzSpecificLocalTime(Account.LBMC_MaximumExpirationDate, | |
us.TimeZoneBias, | |
us.TimeZoneDaylightBias, | |
us.TimeZoneDaylightYear, | |
us.TimeZoneDaylightMonth, | |
us.TimeZoneDaylightDay, | |
us.TimeZoneDaylightHour, | |
us.TimeZoneDaylightMinute, | |
us.TimeZoneDaylightSecond, | |
0, | |
us.TimeZoneDaylightDayOfWeek, | |
us.TimeZoneStandardBias, | |
us.TimeZoneStandardYear, | |
us.TimeZoneStandardMonth, | |
us.TimeZoneStandardDay, | |
us.TimeZoneStandardHour, | |
us.TimeZoneStandardMinute, | |
us.TimeZoneStandardSecond, | |
0, | |
us.TimeZoneStandardDayOfWeek), | |
Account.LBMC_MaximumExpirationDate, | |
Account.MarketCap, | |
Account.MarketCap_Base, | |
Account.MasterAccountIdDsc, | |
Account.MasterAccountIdName, | |
Account.MasterAccountIdYomiName, | |
Account.MasterId, | |
Account.Merged, | |
MergedPLTable.Value, | |
Account.ModifiedBy, | |
Account.ModifiedByDsc, | |
Account.ModifiedByName, | |
Account.ModifiedByYomiName, | |
dbo.fn_UTCToTzSpecificLocalTime(Account.ModifiedOn, | |
us.TimeZoneBias, | |
us.TimeZoneDaylightBias, | |
us.TimeZoneDaylightYear, | |
us.TimeZoneDaylightMonth, | |
us.TimeZoneDaylightDay, | |
us.TimeZoneDaylightHour, | |
us.TimeZoneDaylightMinute, | |
us.TimeZoneDaylightSecond, | |
0, | |
us.TimeZoneDaylightDayOfWeek, | |
us.TimeZoneStandardBias, | |
us.TimeZoneStandardYear, | |
us.TimeZoneStandardMonth, | |
us.TimeZoneStandardDay, | |
us.TimeZoneStandardHour, | |
us.TimeZoneStandardMinute, | |
us.TimeZoneStandardSecond, | |
0, | |
us.TimeZoneStandardDayOfWeek), | |
Account.ModifiedOn, | |
Account.Name, | |
Account.NumberOfEmployees, | |
Account.OriginatingLeadId, | |
Account.OriginatingLeadIdDsc, | |
Account.OriginatingLeadIdName, | |
Account.OriginatingLeadIdYomiName, | |
dbo.fn_UTCToTzSpecificLocalTime(Account.OverriddenCreatedOn, | |
us.TimeZoneBias, | |
us.TimeZoneDaylightBias, | |
us.TimeZoneDaylightYear, | |
us.TimeZoneDaylightMonth, | |
us.TimeZoneDaylightDay, | |
us.TimeZoneDaylightHour, | |
us.TimeZoneDaylightMinute, | |
us.TimeZoneDaylightSecond, | |
0, | |
us.TimeZoneDaylightDayOfWeek, | |
us.TimeZoneStandardBias, | |
us.TimeZoneStandardYear, | |
us.TimeZoneStandardMonth, | |
us.TimeZoneStandardDay, | |
us.TimeZoneStandardHour, | |
us.TimeZoneStandardMinute, | |
us.TimeZoneStandardSecond, | |
0, | |
us.TimeZoneStandardDayOfWeek), | |
Account.OverriddenCreatedOn, | |
Account.OwnerId, | |
Account.OwnerIdDsc, | |
Account.OwnerIdName, | |
Account.OwnerIdType, | |
Account.OwnerIdYomiName, | |
Account.OwnershipCode, | |
OwnershipCodePLTable.Value, | |
Account.OwningBusinessUnit, | |
Account.OwningTeam, | |
Account.OwningUser, | |
Account.ParentAccountId, | |
Account.ParentAccountIdDsc, | |
Account.ParentAccountIdName, | |
Account.ParentAccountIdYomiName, | |
Account.ParticipatesInWorkflow, | |
ParticipatesInWorkflowPLTable.Value, | |
Account.PaymentTermsCode, | |
PaymentTermsCodePLTable.Value, | |
Account.PreferredAppointmentDayCode, | |
PreferredAppointmentDayCodePLTable.Value, | |
Account.PreferredAppointmentTimeCode, | |
PreferredAppointmentTimeCodePLTable.Value, | |
Account.PreferredContactMethodCode, | |
PreferredContactMethodCodePLTable.Value, | |
Account.PreferredEquipmentId, | |
Account.PreferredEquipmentIdDsc, | |
Account.PreferredEquipmentIdName, | |
Account.PreferredServiceId, | |
Account.PreferredServiceIdDsc, | |
Account.PreferredServiceIdName, | |
Account.PreferredSystemUserId, | |
Account.PreferredSystemUserIdDsc, | |
Account.PreferredSystemUserIdName, | |
Account.PreferredSystemUserIdYomiName, | |
Account.PrimaryContactId, | |
Account.PrimaryContactIdDsc, | |
Account.PrimaryContactIdName, | |
Account.PrimaryContactIdYomiName, | |
Account.Revenue, | |
Account.Revenue_Base, | |
Account.SharesOutstanding, | |
Account.ShippingMethodCode, | |
ShippingMethodCodePLTable.Value, | |
Account.SIC, | |
Account.StateCode, | |
StateCodePLTable.Value, | |
Account.StatusCode, | |
StatusCodePLTable.Value, | |
Account.StockExchange, | |
Account.Telephone1, | |
Account.Telephone2, | |
Account.Telephone3, | |
Account.TerritoryCode, | |
TerritoryCodePLTable.Value, | |
Account.TerritoryId, | |
Account.TerritoryIdDsc, | |
Account.TerritoryIdName, | |
Account.TickerSymbol, | |
Account.TimeZoneRuleVersionNumber, | |
Account.TransactionCurrencyId, | |
Account.TransactionCurrencyIdDsc, | |
Account.TransactionCurrencyIdName, | |
Account.UTCConversionTimeZoneCode, | |
Account.WebSiteURL, | |
Account.YomiName, | |
dbo.fn_GetNumberFormatString(2, us.NumberGroupFormat, us.NegativeCurrencyFormatCode, 1, case o.CurrencyDisplayOption when 0 then t.CurrencySymbol when 1 then t.ISOCurrencyCode end, us.CurrencyFormatCode) | |
from Account | |
left join SystemUserBase u on (u.SystemUserId = dbo.fn_FindUserGuid() and u.IsDisabled = 0) | |
left join UserSettingsBase us on us.SystemUserId = u.SystemUserId | |
left join OrganizationBase o on u.OrganizationId = o.OrganizationId | |
left join TransactionCurrencyBase t on t.TransactionCurrencyId = Account.TransactionCurrencyId | |
left outer join StringMap AccountCategoryCodePLTable on | |
(AccountCategoryCodePLTable.AttributeName = 'accountcategorycode' | |
and AccountCategoryCodePLTable.ObjectTypeCode = 1 | |
and AccountCategoryCodePLTable.AttributeValue = Account.AccountCategoryCode | |
and AccountCategoryCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap AccountClassificationCodePLTable on | |
(AccountClassificationCodePLTable.AttributeName = 'accountclassificationcode' | |
and AccountClassificationCodePLTable.ObjectTypeCode = 1 | |
and AccountClassificationCodePLTable.AttributeValue = Account.AccountClassificationCode | |
and AccountClassificationCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap AccountRatingCodePLTable on | |
(AccountRatingCodePLTable.AttributeName = 'accountratingcode' | |
and AccountRatingCodePLTable.ObjectTypeCode = 1 | |
and AccountRatingCodePLTable.AttributeValue = Account.AccountRatingCode | |
and AccountRatingCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap Address1_AddressTypeCodePLTable on | |
(Address1_AddressTypeCodePLTable.AttributeName = 'address1_addresstypecode' | |
and Address1_AddressTypeCodePLTable.ObjectTypeCode = 1 | |
and Address1_AddressTypeCodePLTable.AttributeValue = Account.Address1_AddressTypeCode | |
and Address1_AddressTypeCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap Address1_FreightTermsCodePLTable on | |
(Address1_FreightTermsCodePLTable.AttributeName = 'address1_freighttermscode' | |
and Address1_FreightTermsCodePLTable.ObjectTypeCode = 1 | |
and Address1_FreightTermsCodePLTable.AttributeValue = Account.Address1_FreightTermsCode | |
and Address1_FreightTermsCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap Address1_ShippingMethodCodePLTable on | |
(Address1_ShippingMethodCodePLTable.AttributeName = 'address1_shippingmethodcode' | |
and Address1_ShippingMethodCodePLTable.ObjectTypeCode = 1 | |
and Address1_ShippingMethodCodePLTable.AttributeValue = Account.Address1_ShippingMethodCode | |
and Address1_ShippingMethodCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap Address2_AddressTypeCodePLTable on | |
(Address2_AddressTypeCodePLTable.AttributeName = 'address2_addresstypecode' | |
and Address2_AddressTypeCodePLTable.ObjectTypeCode = 1 | |
and Address2_AddressTypeCodePLTable.AttributeValue = Account.Address2_AddressTypeCode | |
and Address2_AddressTypeCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap Address2_FreightTermsCodePLTable on | |
(Address2_FreightTermsCodePLTable.AttributeName = 'address2_freighttermscode' | |
and Address2_FreightTermsCodePLTable.ObjectTypeCode = 1 | |
and Address2_FreightTermsCodePLTable.AttributeValue = Account.Address2_FreightTermsCode | |
and Address2_FreightTermsCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap Address2_ShippingMethodCodePLTable on | |
(Address2_ShippingMethodCodePLTable.AttributeName = 'address2_shippingmethodcode' | |
and Address2_ShippingMethodCodePLTable.ObjectTypeCode = 1 | |
and Address2_ShippingMethodCodePLTable.AttributeValue = Account.Address2_ShippingMethodCode | |
and Address2_ShippingMethodCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap BusinessTypeCodePLTable on | |
(BusinessTypeCodePLTable.AttributeName = 'businesstypecode' | |
and BusinessTypeCodePLTable.ObjectTypeCode = 1 | |
and BusinessTypeCodePLTable.AttributeValue = Account.BusinessTypeCode | |
and BusinessTypeCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap CCS_CurrentContractonFile2PLTable on | |
(CCS_CurrentContractonFile2PLTable.AttributeName = 'ccs_currentcontractonfile2' | |
and CCS_CurrentContractonFile2PLTable.ObjectTypeCode = 1 | |
and CCS_CurrentContractonFile2PLTable.AttributeValue = Account.CCS_CurrentContractonFile2 | |
and CCS_CurrentContractonFile2PLTable.LangId = us.UILanguageId ) | |
left outer join StringMap CCS_VendorRegistrationNeededPLTable on | |
(CCS_VendorRegistrationNeededPLTable.AttributeName = 'ccs_vendorregistrationneeded' | |
and CCS_VendorRegistrationNeededPLTable.ObjectTypeCode = 1 | |
and CCS_VendorRegistrationNeededPLTable.AttributeValue = Account.CCS_VendorRegistrationNeeded | |
and CCS_VendorRegistrationNeededPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap CreditOnHoldPLTable on | |
(CreditOnHoldPLTable.AttributeName = 'creditonhold' | |
and CreditOnHoldPLTable.ObjectTypeCode = 1 | |
and CreditOnHoldPLTable.AttributeValue = Account.CreditOnHold | |
and CreditOnHoldPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap CustomerSizeCodePLTable on | |
(CustomerSizeCodePLTable.AttributeName = 'customersizecode' | |
and CustomerSizeCodePLTable.ObjectTypeCode = 1 | |
and CustomerSizeCodePLTable.AttributeValue = Account.CustomerSizeCode | |
and CustomerSizeCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap CustomerTypeCodePLTable on | |
(CustomerTypeCodePLTable.AttributeName = 'customertypecode' | |
and CustomerTypeCodePLTable.ObjectTypeCode = 1 | |
and CustomerTypeCodePLTable.AttributeValue = Account.CustomerTypeCode | |
and CustomerTypeCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotBulkEMailPLTable on | |
(DoNotBulkEMailPLTable.AttributeName = 'donotbulkemail' | |
and DoNotBulkEMailPLTable.ObjectTypeCode = 1 | |
and DoNotBulkEMailPLTable.AttributeValue = Account.DoNotBulkEMail | |
and DoNotBulkEMailPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotBulkPostalMailPLTable on | |
(DoNotBulkPostalMailPLTable.AttributeName = 'donotbulkpostalmail' | |
and DoNotBulkPostalMailPLTable.ObjectTypeCode = 1 | |
and DoNotBulkPostalMailPLTable.AttributeValue = Account.DoNotBulkPostalMail | |
and DoNotBulkPostalMailPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotEMailPLTable on | |
(DoNotEMailPLTable.AttributeName = 'donotemail' | |
and DoNotEMailPLTable.ObjectTypeCode = 1 | |
and DoNotEMailPLTable.AttributeValue = Account.DoNotEMail | |
and DoNotEMailPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotFaxPLTable on | |
(DoNotFaxPLTable.AttributeName = 'donotfax' | |
and DoNotFaxPLTable.ObjectTypeCode = 1 | |
and DoNotFaxPLTable.AttributeValue = Account.DoNotFax | |
and DoNotFaxPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotPhonePLTable on | |
(DoNotPhonePLTable.AttributeName = 'donotphone' | |
and DoNotPhonePLTable.ObjectTypeCode = 1 | |
and DoNotPhonePLTable.AttributeValue = Account.DoNotPhone | |
and DoNotPhonePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotPostalMailPLTable on | |
(DoNotPostalMailPLTable.AttributeName = 'donotpostalmail' | |
and DoNotPostalMailPLTable.ObjectTypeCode = 1 | |
and DoNotPostalMailPLTable.AttributeValue = Account.DoNotPostalMail | |
and DoNotPostalMailPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap DoNotSendMMPLTable on | |
(DoNotSendMMPLTable.AttributeName = 'donotsendmm' | |
and DoNotSendMMPLTable.ObjectTypeCode = 1 | |
and DoNotSendMMPLTable.AttributeValue = Account.DoNotSendMM | |
and DoNotSendMMPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap IndustryCodePLTable on | |
(IndustryCodePLTable.AttributeName = 'industrycode' | |
and IndustryCodePLTable.ObjectTypeCode = 1 | |
and IndustryCodePLTable.AttributeValue = Account.IndustryCode | |
and IndustryCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap IsPrivatePLTable on | |
(IsPrivatePLTable.AttributeName = 'isprivate' | |
and IsPrivatePLTable.ObjectTypeCode = 1 | |
and IsPrivatePLTable.AttributeValue = Account.IsPrivate | |
and IsPrivatePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap MergedPLTable on | |
(MergedPLTable.AttributeName = 'merged' | |
and MergedPLTable.ObjectTypeCode = 1 | |
and MergedPLTable.AttributeValue = Account.Merged | |
and MergedPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap OwnershipCodePLTable on | |
(OwnershipCodePLTable.AttributeName = 'ownershipcode' | |
and OwnershipCodePLTable.ObjectTypeCode = 1 | |
and OwnershipCodePLTable.AttributeValue = Account.OwnershipCode | |
and OwnershipCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap ParticipatesInWorkflowPLTable on | |
(ParticipatesInWorkflowPLTable.AttributeName = 'participatesinworkflow' | |
and ParticipatesInWorkflowPLTable.ObjectTypeCode = 1 | |
and ParticipatesInWorkflowPLTable.AttributeValue = Account.ParticipatesInWorkflow | |
and ParticipatesInWorkflowPLTable.LangId = us.UILanguageId ) | |
left outer join StringMap PaymentTermsCodePLTable on | |
(PaymentTermsCodePLTable.AttributeName = 'paymenttermscode' | |
and PaymentTermsCodePLTable.ObjectTypeCode = 1 | |
and PaymentTermsCodePLTable.AttributeValue = Account.PaymentTermsCode | |
and PaymentTermsCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap PreferredAppointmentDayCodePLTable on | |
(PreferredAppointmentDayCodePLTable.AttributeName = 'preferredappointmentdaycode' | |
and PreferredAppointmentDayCodePLTable.ObjectTypeCode = 1 | |
and PreferredAppointmentDayCodePLTable.AttributeValue = Account.PreferredAppointmentDayCode | |
and PreferredAppointmentDayCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap PreferredAppointmentTimeCodePLTable on | |
(PreferredAppointmentTimeCodePLTable.AttributeName = 'preferredappointmenttimecode' | |
and PreferredAppointmentTimeCodePLTable.ObjectTypeCode = 1 | |
and PreferredAppointmentTimeCodePLTable.AttributeValue = Account.PreferredAppointmentTimeCode | |
and PreferredAppointmentTimeCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap PreferredContactMethodCodePLTable on | |
(PreferredContactMethodCodePLTable.AttributeName = 'preferredcontactmethodcode' | |
and PreferredContactMethodCodePLTable.ObjectTypeCode = 1 | |
and PreferredContactMethodCodePLTable.AttributeValue = Account.PreferredContactMethodCode | |
and PreferredContactMethodCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap ShippingMethodCodePLTable on | |
(ShippingMethodCodePLTable.AttributeName = 'shippingmethodcode' | |
and ShippingMethodCodePLTable.ObjectTypeCode = 1 | |
and ShippingMethodCodePLTable.AttributeValue = Account.ShippingMethodCode | |
and ShippingMethodCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap StateCodePLTable on | |
(StateCodePLTable.AttributeName = 'statecode' | |
and StateCodePLTable.ObjectTypeCode = 1 | |
and StateCodePLTable.AttributeValue = Account.StateCode | |
and StateCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap StatusCodePLTable on | |
(StatusCodePLTable.AttributeName = 'statuscode' | |
and StatusCodePLTable.ObjectTypeCode = 1 | |
and StatusCodePLTable.AttributeValue = Account.StatusCode | |
and StatusCodePLTable.LangId = us.UILanguageId ) | |
left outer join StringMap TerritoryCodePLTable on | |
(TerritoryCodePLTable.AttributeName = 'territorycode' | |
and TerritoryCodePLTable.ObjectTypeCode = 1 | |
and TerritoryCodePLTable.AttributeValue = Account.TerritoryCode | |
and TerritoryCodePLTable.LangId = us.UILanguageId ) | |
cross join dbo.fn_GetMaxPrivilegeDepthMask(1) pdm | |
where Account.DeletionStateCode in (0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment