Regular Expressions 101

Save & Share

  • Regex Version: ver. 2
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
gmi

Test String

Code Generator

Generated Code

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "\\bcreate[ \\t]+(view|procedure|proc)[ \\t]+(.+)\\n(((?![ \\t]*go[ \\t]*).*\\n)+)[ \\t]*go[ \\t]*$"; final String string = "set quoted_identifier on\n" + "set ansi_nulls on\n" + "go\n" + " \n" + "--------------------------------------------------------------------------------\n" + "-- NAME: AP_INVOICE\n" + "--\n" + "-- PURPOSE: Represents the one to one relationship between Fin_APINVMST and\n" + "-- Fin_SUBINV. No filtering done, this view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('AP_INVOICE'), 'IsView') = 1 \n" + " drop view AP_INVOICE\n" + "go\n\n" + "create view AP_INVOICE as\n" + " select a.APIMIVNM \n" + " ,a.APIMVNID \n" + " ,a.APIMDATE \n" + " ,a.APIMTYPE \n" + " ,a.APIMDOCN \n" + " ,a.APIMICDT \n" + " ,a.APIMUTAX \n" + " ,a.APIMVOCH \n" + " ,a.APIMLCRD \n" + " ,a._Row APINVMST_Row \n" + " ,a._APOPNINV_OwnRow \n" + " ,a._APVENINV_OwnRow \n" + " ,a._Ts APINVMST_Ts \n" + " ,s.APIMPDID \n" + " ,s.APIMYRID \n" + " ,s.APIMIVST \n" + " ,s.APIMSTDT \n" + " ,s.APIMMERC \n" + " ,s.APIMIPFL \n" + " ,s.APIMFRET \n" + " ,s.APIMFTFL \n" + " ,s.APIMOCHG \n" + " ,s.APIMOCFL \n" + " ,s.APIMSTAX \n" + " ,s.APIMSTFL \n" + " ,s.APIMSCHG \n" + " ,s.APIMDS1D \n" + " ,s.APIMDS1A \n" + " ,s.APIMDS2D \n" + " ,s.APIMDS2A \n" + " ,s.APIMDUDT \n" + " ,s.APIMNRCV \n" + " ,s.APIMMTST \n" + " ,s.APIMCMNT \n" + " ,s.APIMDISC \n" + " ,s.APIMPYMT \n" + " ,s.APIMPYST \n" + " ,s.APIMPSDT \n" + " ,s.APIMAGE \n" + " ,s.APIMTAMT \n" + " ,s.APIMRFLG \n" + " ,s.APIMFAMT \n" + " ,s.APIMFMTP \n" + " ,s.APIMFMTD \n" + " ,s.APIMCTRL \n" + " ,s.APPAYHOW \n" + " ,s.APPAYWEN \n" + " ,s.APCUTOFF \n" + " ,s.APDELAY \n" + " ,s.APPAYAM1 \n" + " ,s.APPAYDY1 \n" + " ,s.APPAYAM2 \n" + " ,s.APPAYDY2 \n" + " ,s.APPAYAM3 \n" + " ,s.APPAYDY3 \n" + " ,s.APPAYAM4 \n" + " ,s.APIMXVAR \n" + " ,s.APIMXRAT \n" + " ,s._Row SUBINV_Row \n" + " ,s._INVSUB_OwnRow \n" + " ,s._Ts SUBINV_Ts\n" + " from Fin_APINVMST a\n" + " left join Fin_SUBINV s on (s._INVSUB_OwnRow = a._Row)\n" + " with check option\n" + "go \n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_COMTHeader]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_COMTHeader]\n" + "go\n\n" + "create view EDI_COMTHeader as\n" + "(\n" + " select c.CO_NUMBER\n" + " ,c.CUST_ID\n" + " ,c.ACK_TYPE\n" + " ,c.PREV_EXT\n" + " ,c.SHIP_TO\n" + " ,c.DISC_1PCNT\n" + " ,c.DISC_1DAYS\n" + " ,c.DISC_2PCNT\n" + " ,c.DISC_2DAYS\n" + " ,c.NET_DAYS\n" + " ,c.TRANS_VIA\n" + " ,c.FOB_POINT\n" + " ,c.INV_CODE\n" + " ,c.FOB_CODE\n" + " ,c.PO_NUMBER\n" + " ,c.EDICOHeaderKey\n" + " from <FSDBXXTemp, char, >.[dbo].COMTHEAD c\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_COMTLine]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_COMTLine]\n" + "go\n\n" + "create view EDI_COMTLine as\n" + "(\n" + " select c.CO_NUMBER\n" + " ,c.LN_NO\n" + " ,c.ORDLN_NO\n" + " ,c.SUBLN_NO\n" + " ,c.LINE_TYPE\n" + " ,c.ORDER_QTY\n" + " ,c.RECV_QTY\n" + " ,c.ITM_REV\n" + " ,c.UM\n" + " ,c.LN_STA\n" + " ,c.LN_TYPE\n" + " ,c.ITM_GLMOCO\n" + " ,c.[DESC]\n" + " ,c.VEND_ITEM\n" + " ,c.VI_DESC\n" + " ,c.VI_UM\n" + " ,c.VI_UMCNVT\n" + " ,c.STRT_DT\n" + " ,c.PROM_DOCK\n" + " ,c.UNIT_PRICE\n" + " ,c.PO_NUMBER\n" + " ,c.PO_LNNO\n" + " ,c.EDICOLineKey\n" + " from <FSDBXXTemp, char, >.[dbo].COMTLINE c\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_COMTText]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_COMTText]\n" + "go\n\n" + "create view EDI_COMTText as\n" + "(\n" + " select c.ORDER_NO\n" + " ,c.LN_NO\n" + " ,c.PO_NUMBER\n" + " ,c.ORDLN_NO\n" + " ,c.SUBLN_NO\n" + " ,c.XTXT_NO\n" + " ,c.TEXT_LN1\n" + " ,c.TEXT_LN2\n" + " ,c.TEXT_LN3\n" + " ,c.TEXT_LN4\n" + " ,c.EDICOTextKey\n" + " from <FSDBXXTemp, char, >.[dbo].COMTTEXT c\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_PACKHeader]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_PACKHeader]\n" + "go\n\n" + "create view EDI_PACKHeader as\n" + "(\n" + " select p.EDI_KEY_ID\n" + " ,p.SHPMNT_NO\n" + " ,p.CUST_ID\n" + " ,p.LST_STYLE\n" + " ,p.TS_SID\n" + " ,p.SHIP_DATE\n" + " ,p.SHIP_TIME\n" + " ,p.ARVL_DATE\n" + " ,p.ARVL_TIME\n" + " ,p.ADR_TY_1\n" + " ,p.ADR_NM_1\n" + " ,p.ADR_CD_1\n" + " ,p.ADR_ID_1\n" + " ,p.ST_ADDR1\n" + " ,p.ST_ADDR2\n" + " ,p.ST_CITY\n" + " ,p.ST_STATE\n" + " ,p.ST_ZIP\n" + " ,p.ST_CNTRY\n" + " ,p.ADR_TY_2\n" + " ,p.ADR_NM_2\n" + " ,p.ADR_CD_2\n" + " ,p.ADR_ID_2\n" + " ,p.SF_ADDR1\n" + " ,p.SF_ADDR2\n" + " ,p.SF_CITY\n" + " ,p.SF_STATE\n" + " ,p.SF_ZIP\n" + " ,p.SF_CNTRY\n" + " ,p.ADR_TY_3\n" + " ,p.ADR_NM_3\n" + " ,p.ADR_CD_3\n" + " ,p.ADR_ID_3\n" + " ,p.BT_ADDR1\n" + " ,p.BT_ADDR2\n" + " ,p.BT_CITY\n" + " ,p.BT_STATE\n" + " ,p.BT_ZIP\n" + " ,p.BT_CNTRY\n" + " ,p.REF_CD_1\n" + " ,p.REF_NO_1\n" + " ,p.REF_CD_2\n" + " ,p.REF_NO_2\n" + " ,p.TD3_ENO_1\n" + " ,p.TD3_SNO_1\n" + " ,p.TD5_ID_1\n" + " ,p.TD4_CLS\n" + " ,p.TD4_DSC\n" + " ,p.TOT_GWGT\n" + " ,p.TOT_NWGT\n" + " ,p.TOT_WUM\n" + " ,p.TOT_PALETS\n" + " ,p.TOT_VALUE\n" + " ,p.TOT_FRGHT\n" + " ,p.EDI_STATUS\n" + " ,p.EDIPackageHeaderKey\n" + " from <FSDBXXTemp, char, >.[dbo].PACKHEAD p\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_PACKLine]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_PACKLine]\n" + "go\n\n" + "create view EDI_PACKLine as\n" + "(\n" + " select p.EDI_KEY_ID\n" + " ,p.EDI_KEY_LN\n" + " ,p.EDI_KEY_SL\n" + " ,p.SHPMNT_NO\n" + " ,p.PKGNO_STRT\n" + " ,p.CUST_DESC\n" + " ,p.ITEM\n" + " ,p.TOTPKGS\n" + " ,p.PCSPER\n" + " ,p.SHP_UM\n" + " ,p.UNIT_PRICE\n" + " ,p.LIN_CD_1\n" + " ,p.LIN_ID_1\n" + " ,p.LIN_CD_2\n" + " ,p.LIN_ID_2\n" + " ,p.LIN_CD_3\n" + " ,p.LIN_ID_3\n" + " ,p.LIN_CD_4\n" + " ,p.LIN_ID_4\n" + " ,p.LIN_CD_5\n" + " ,p.LIN_ID_5\n" + " ,p.PO_NUMBER\n" + " ,p.PO_LNNO\n" + " ,p.RELS_NO\n" + " ,p.CO_NUMBER\n" + " ,p.CO_LN_NO\n" + " ,p.NMFC_ITEM\n" + " ,p.NMFC_SUB\n" + " ,p.PKGNO\n" + " ,p.PKG_PCD\n" + " ,p.PKG_PDCD\n" + " ,p.PKG_WGT\n" + " ,p.PKG_WUM\n" + " ,p.LS_RCSNO\n" + " ,p.PLTNO\n" + " ,p.PLT_PDCD\n" + " ,p.MS_RCSNO\n" + " ,p.IPP_TAG\n" + " ,p.EDI_STATUS\n" + " ,p.EDIPackageLineKey\n" + " from <FSDBXXTemp, char, >.[dbo].PACKLINE p\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_POMTHeader]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_POMTHeader]\n" + "go\n\n" + "create view EDI_POMTHeader as\n" + "(\n" + " select p.PO_NUMBER\n" + " ,p.PO_TYPE\n" + " ,p.BUYR\n" + " ,p.VENDOR_ID\n" + " ,p.VENDOR_NAME\n" + " ,p.CONTACT\n" + " ,p.PHONE\n" + " ,p.PO_DT_ORG\n" + " ,p.PO_DT_REV\n" + " ,p.VEND_ADDR2\n" + " ,p.ST_NAME\n" + " ,p.ST_ADDR1\n" + " ,p.ST_ADDR2\n" + " ,p.ST_CITY\n" + " ,p.ST_STATE\n" + " ,p.ST_COUNTRY\n" + " ,p.ST_ZIP\n" + " ,p.DISC_1PCNT\n" + " ,p.DISC_1DAYS\n" + " ,p.DISC_2PCNT\n" + " ,p.DISC_2DAYS\n" + " ,p.NET_DAYS\n" + " ,p.TRANS_VIA\n" + " ,p.FOB_POINT\n" + " ,p.CONTRACT\n" + " ,p.PREV_EXT\n" + " ,p.RELS_NO\n" + " ,p.EDIPOHeaderKey\n" + " from <FSDBXXTemp, char, >.[dbo].POMTHEAD p\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_POMTLine]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_POMTLine]\n" + "go\n\n" + "create view EDI_POMTLine as\n" + "(\n" + " select p.PO_NUMBER\n" + " ,p.LN_NO\n" + " ,p.ORDLN_NO\n" + " ,p.SUBLN_NO\n" + " ,p.LINE_TYPE\n" + " ,p.ORDER_QTY\n" + " ,p.RECV_QTY\n" + " ,p.ITM_REV\n" + " ,p.UM\n" + " ,p.LN_STA\n" + " ,p.LN_TYP\n" + " ,p.ITM_GLMOCO\n" + " ,p.[DESC]\n" + " ,p.VEND_ITEM\n" + " ,p.VI_DESC\n" + " ,p.VI_UM\n" + " ,p.VI_UMCNVT\n" + " ,p.STRT_DT\n" + " ,p.PROM_DOCK\n" + " ,p.UNIT_PRICE\n" + " ,p.HOLD_QTY\n" + " ,p.LRCV_QTY\n" + " ,p.LRCV_DT\n" + " ,p.LRCV_TM\n" + " ,p.PKLST_NO\n" + " ,p.EDIPOLineKey\n" + " from <FSDBXXTemp, char, >.[dbo].POMTLINE p\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_POMTText]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_POMTText]\n" + "go\n\n" + "create view EDI_POMTText as\n" + "(\n" + " select p.ORDER_NO\n" + " ,p.LN_NO\n" + " ,p.PO_NUMBER\n" + " ,p.ORDLN_NO\n" + " ,p.SUBLN_NO\n" + " ,p.XTXT_NO\n" + " ,p.TEXT_LN1\n" + " ,p.TEXT_LN2\n" + " ,p.TEXT_LN3\n" + " ,p.TEXT_LN4\n" + " ,p.EDIPOTextKey\n" + " from <FSDBXXTemp, char, >.[dbo].POMTTEXT p\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_SHIPHeader]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_SHIPHeader]\n" + "go\n\n" + "create view EDI_SHIPHeader as\n" + "(\n" + " select s.SHPMNT_NO\n" + " ,s.CUST_ID\n" + " ,s.SHIP_TO_ID\n" + " ,s.MISC1\n" + " ,s.MISC2\n" + " ,s.TOT_WEIGHT\n" + " ,s.TOT_PALETS\n" + " ,s.TOT_UNITS\n" + " ,s.TOT_FRGHT\n" + " ,s.FTOT_FRGHT\n" + " ,s.PRO_NUMBER\n" + " ,s.CARRIER_ID\n" + " ,s.CARRIER\n" + " ,s.SHIP_TO_NM\n" + " ,s.SHIP_ADDR1\n" + " ,s.SHIP_ADDR2\n" + " ,s.SHIP_CITY\n" + " ,s.SHIP_STATE\n" + " ,s.SHIP_CNTRY\n" + " ,s.SHIP_ZIP\n" + " ,s.SHPMT_DATE\n" + " ,s.SHPMT_REF\n" + " ,s.CTRL_CURR\n" + " ,s.CO_NUMBER\n" + " ,s.CUST_PO_NO\n" + " ,s.EDIShipmentHeaderKey\n" + " from <FSDBXXTemp, char, >.[dbo].SHIPHEAD s\n" + ")\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[EDI_SHIPLine]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[EDI_SHIPLine]\n" + "go\n\n" + "create view EDI_SHIPLine as\n" + "(\n" + " select s.SHPMNT_NO\n" + " ,s.CO_NUMBER\n" + " ,s.CUST_PO_NO\n" + " ,s.ORD_WEIGHT\n" + " ,s.LN_NO\n" + " ,s.SHIP_QTY\n" + " ,s.ORDER_QTY\n" + " ,s.UNIT_PRICE\n" + " ,s.FUNIT_PRIC\n" + " ,s.ITEM\n" + " ,s.ITEM_DESC\n" + " ,s.UM\n" + " ,s.UPC_CODE\n" + " ,s.PACKAGE_NO\n" + " ,s.PKG_TYP\n" + " ,s.UNITS_PER\n" + " ,s.UNIT_TOTAL\n" + " ,s.EDIShipmentLineKey\n" + " from <FSDBXXTemp, char, >.[dbo].SHIPLINE s\n" + ")\n" + "go\n\n" + "-------------------------------------------------------------------------------------------------------------\n" + "-- NAME: Workflow_UserData; Workflow_GroupData; Workflow_ProcessData; ENG_BOM;\n" + "-- ENG_ITEM; REFDES; DefinedPhases; DefinedRules; DefinedConditions; LinkedPhaseRules;\n" + "-- LinkedRuleEdits; LinkedSelections; USERVIEWS1;\n" + "-- \n" + "-- PURPOSE: Used for ENGM/MMAM; keep the consistency with the original Access tables.\n" + "-- \n" + "-------------------------------------------------------------------------------------------------------------\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DefinedConditions]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[DefinedConditions]\n" + "go\n\n" + "create view DefinedConditions\n" + "as\n" + "select f.ConditionName as ConditionName\n" + " ,f.FieldName as FieldName\n" + " ,f.TableName as TableName\n" + " ,f.RelationshipText as RelationshipText\n" + " ,f.RelationshipType as RelationshipType\n" + " ,f.RelationshipCategory as RelationshipCategory\n" + " ,f.ConditionValue as [Values]\n" + " ,f.FieldValueTableName as FieldValueTableName\n" + " ,f.FieldCaption as FieldCaption\n" + " ,f.ValueCaption as ValueCaption\n" + " ,f.ItemPromotionConditionRowVersion as RowVersion\n" + " ,f.ItemPromotionConditionKey as ConditionKey\n" + "from FS_ItemPromotionCondition f\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DefinedPhases]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[DefinedPhases]\n" + "go\n\n" + "create view DefinedPhases\n" + "as\n" + "select f.PhaseName as PhaseName\n" + " ,f.ItemPromotionPhaseRowVersion as RowVersion\n" + " ,f.ItemPromotionPhaseKey as PhaseKey\n" + "from FS_ItemPromotionPhase f\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DefinedRules]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[DefinedRules]\n" + "go\n\n" + "create view DefinedRules\n" + "as\n" + "select f.RuleName as RuleName\n" + " ,f.IsWarningOnly as WarningOnly\n" + " ,f.ItemPromotionRuleRowVersion as RowVersion\n" + " ,f.ItemPromotionRuleKey as RuleKey\n" + "from FS_ItemPromotionRule f\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ENG_BOM]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[ENG_BOM]\n" + "go\n\n" + "create view ENG_BOM\n" + "as\n" + "select f.PointOfUseID as PT_USE\n" + " ,f.OperationSequenceNumber as SEQN\n" + " ,f.RequiredQuantity as QUANTITY\n" + " ,f.QuantityType as QTY_TYP\n" + " ,f.ComponentType as COM_TYP\n" + " ,f.InEffectivityDate as IN_EFFECT\n" + " ,f.OutEffectivityDate as OUT_EFFECT\n" + " ,f.InRevision as IN_REV\n" + " ,f.OutRevision as OUT_REV\n" + " ,f.Text as TEXT\n" + " ,f.ProductionComponentItemNumber as PROD_COMPONENT\n" + " ,f.LeadTimeOffsetDays as LT_OFFSET\n" + " ,f.ScrapPercent as SCRAP_PCNT\n" + " ,p.EngineeringItemNumber as PARENT\n" + " ,c.EngineeringItemNumber as COMPONENT\n" + " ,f.EngineeringBillOfMaterialKey as KEY_RECORD\n" + " ,f.ParentEngineeringItemKey as ParentEngineeringItemKey\n" + " ,f.ComponentEngineeringItemKey as ComponentEngineeringItemKey\n" + " ,f.EngineeringBillOfMaterialRowVersion as RowVersion \n" + "from FS_EngineeringItem p \n" + " inner join FS_EngineeringBillOfMaterial f on p.EngineeringItemKey = f.ParentEngineeringItemKey \n" + " left outer join FS_EngineeringItem c on f.ComponentEngineeringItemKey = c.EngineeringItemKey\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ENG_ITEM]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[ENG_ITEM]\n" + "go\n\n" + "create view ENG_ITEM\n" + "as\n" + "select f.EngineeringItemNumber as ITEM\n" + " ,f.EngineeringItemDescription as ITEM_DESC\n" + " ,f.EngineeringItemUM as UM\n" + " ,f.MakeBuyCode as MB\n" + " ,f.DrawingNumber as DRWG\n" + " ,f.ItemRevision as REV\n" + " ,f.DecimalPrecision as DPC\n" + " ,f.ItemLocalUnitPrice as PRICE\n" + " ,f.ItemCost as COST\n" + " ,f.ProductionItemNumber as PROD_ITEM\n" + " ,f.PhaseDate as PHASE_DATE\n" + " ,f.ItemType as ITEM_TYPE\n" + " ,f.FixedLeadTimeDays as FIXED_LEAD_TIME\n" + " ,f.ProposedProductionItemNumber as PROPOSED_PROD_ITEM\n" + " ,f.ItemPromotionPhaseKey as PHASE\n" + " ,f.ItemKey as ItemKey\n" + " ,f.ItemPromotionPhaseKey as ItemPromotionPhaseKey\n" + " ,f.EngineeringItemKey as EngineeringItemKey \n" + "from FS_EngineeringItem f\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LinkedPhaseRules]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[LinkedPhaseRules]\n" + "go\n\n" + "create view LinkedPhaseRules\n" + "as\n" + "select f.ItemPromotionPhaseKey as PhaseKey\n" + " ,f.ItemPromotionRuleKey as RuleKey\n" + " ,f.ItemPromotionPhaseRuleLinkRowVersion as RowVersion\n" + "from FS_ItemPromotionPhaseRuleLink f\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LinkedRuleEdits]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[LinkedRuleEdits]\n" + "go\n\n" + "create view LinkedRuleEdits\n" + "as\n" + "select f.ItemPromotionRuleKey as RuleKey\n" + " ,f.ItemPromotionConditionKey as EditKey\n" + " ,f.ItemPromotionRuleConditionLinkRowVersion as RowVersion\n" + "from FS_ItemPromotionRuleConditionLink f\n" + "where f.IsEditOrSelection='E'\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[LinkedRuleSelections]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[LinkedRuleSelections]\n" + "go\n\n" + "create view LinkedRuleSelections\n" + "as\n" + "select f.ItemPromotionRuleKey as RuleKey\n" + " ,f.ItemPromotionConditionKey as SelectionKey\n" + " ,f.ItemPromotionRuleConditionLinkRowVersion as RowVersion\n" + "from FS_ItemPromotionRuleConditionLink f\n" + "where f.IsEditOrSelection='S'\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[REFDES]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[REFDES]\n" + "go\n\n" + "create view REFDES\n" + "as\n" + "select f.ParentItemSource as PARENT_SOURCE\n" + " ,f.ParentEngineeringItemNumber as PARENT\n" + " ,f.PointOfUseID as PT_USE\n" + " ,f.OperationSequenceNumber as SEQN\n" + " ,f.ItemSource as ITEM_SOURCE\n" + " ,f.EngineeringItemNumber as ITEM\n" + " ,f.ReferenceDesignator as REFDES\n" + " ,f.ReferenceDesignatorPreFix as RD_A\n" + " ,f.ReferenceDesignatorNumber as RD_B\n" + " ,f.ReferenceDesignatorText as RD_TAG\n" + " ,f.InEffectivityDate as RD_IN_EFFECT\n" + " ,f.OutEffectivityDate as RD_OUT_EFFECT\n" + " ,f.ReferenceDesignatorError as RD_ERROR\n" + " ,f.ParentEngineeringItemKey as ParentEngineeringItemKey\n" + " ,f.EngineeringItemKey as EngineeringItemKey\n" + " ,f.ReferenceDesignatorRowVersion as RowVersion\n" + " ,f.ReferenceDesignatorKey as ReferenceDesignatorKey\n" + "from FS_ReferenceDesignator f\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[USERVIEWS1]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[USERVIEWS1]\n" + "go\n\n" + "create view USERVIEWS1\n" + "as\n" + "select f.StandardGridNumber as STANDARDVIEWNUMBER\n" + " ,f.UserGridSource as ViewSource\n" + " ,f.IsLocalOrGlobal as IsLocalOrGlobal\n" + " ,f.UserGridType as ViewType\n" + " ,f.UserGridName as ViewName\n" + " ,f.Owner as Owner\n" + " ,f.SortUserGridColumnKey as SORTCOLUMN\n" + " ,f.ReportPathName as REPORTNAME\n" + " ,f.RowHeight as RowHeight\n" + " ,f.[Option] as OPTIONS\n" + " ,f.Argument as Argument\n" + " ,f.UserGridRowVersion as RowVersion\n" + " ,f.UserGridKey as UserGridKey \n" + "from FS_UserGrid f\n" + "go\n\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Workflow_ProcessData]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[Workflow_ProcessData]\n" + "go\n\n" + "create view Workflow_ProcessData\n" + "as\n" + "select p.ProcessNumber\n" + " ,pd.ActivitySequence\n" + " ,pd.ActivityStatus\n" + " ,pd.IsCompleted\n" + " ,pd.StartDate\n" + " ,pd.CompletedDate\n" + " ,pd.IsNotificationMailed\n" + " ,a.ActivityName\n" + " ,a.ActivityDescription\n" + " ,a.AllowedDays\n" + " ,a.StartupMessage\n" + " ,a.WorkflowActivityKey\n" + " ,p.WorkflowProcessKey\n" + " ,pd.WorkflowProcessDataKey\n" + "from FS_WorkflowProcessData pd \n" + " inner join FS_WorkflowProcess p on pd.WorkflowProcessKey = p.WorkflowProcessKey \n" + " inner join FS_WorkflowActivity a on pd.WorkflowActivityKey = a.WorkflowActivityKey\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Workflow_GroupData]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[Workflow_GroupData]\n" + "go\n\n" + "create view Workflow_GroupData\n" + "as\n" + "select pd.ProcessNumber\n" + " ,gd.GroupStatus\n" + " ,gd.IsCompleted\n" + " ,gd.StartDate\n" + " ,gd.CompletedDate\n" + " ,g.GroupName\n" + " ,g.GroupDescription\n" + " ,g.IsNotificationOnly\n" + " ,pd.WorkflowProcessKey\n" + " ,pd.WorkflowActivityKey\n" + " ,gd.WorkflowGroupKey\n" + " ,gd.WorkflowGroupDataKey\n" + "from FS_WorkflowGroup g \n" + " inner join FS_WorkflowGroupData gd on g.WorkflowGroupKey = gd.WorkflowGroupKey \n" + " inner join Workflow_ProcessData pd on gd.WorkflowProcessDataKey = pd.WorkflowProcessDataKey\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Workflow_UserData]') and OBJECTPROPERTY(id, N'IsView') = 1)\n" + "drop view [dbo].[Workflow_UserData]\n" + "go\n\n" + "create view Workflow_UserData\n" + "as\n" + "select gd.WorkflowGroupDataKey\n" + " ,gd.ProcessNumber\n" + " ,ud.UserStatus\n" + " ,ud.IsCompleted\n" + " ,ud.StartDate\n" + " ,ud.CompletedDate\n" + " ,ud.Comment\n" + " ,u.UserID\n" + " ,u.LastName\n" + " ,u.FirstName\n" + " ,u.UserEmailName\n" + " ,u.UserEmail\n" + " ,gd.WorkflowProcessKey\n" + " ,gd.WorkflowActivityKey\n" + " ,gd.WorkflowGroupKey\n" + " ,ud.WorkflowUserKey\n" + " ,ud.WorkflowUserDataKey\n" + "from FS_WorkflowUserData ud \n" + " inner join FS_WorkflowUser u on ud.WorkflowUserKey = u.WorkflowUserKey \n" + " inner join Workflow_GroupData gd on ud.WorkflowGroupDataKey = gd.WorkflowGroupDataKey\n" + "go\n\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_CUSTOMER\n" + "--\n" + "-- PURPOSE: Used for the Webui. Represents the one to one relationship \n" + "-- between Mfg_CUSTMAST and Mfg_SUBCUST. Also joins Mfg_TXT using \n" + "-- Mfg_DESCTXT_Lnk and Mfg_PLNRTXT_Lnk. No filtering done, this view \n" + "-- includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FSFORMATDATE'), 'IsScalarFunction') = 1 \n" + " drop function FSFORMATDATE\n" + "go\n\n" + "CREATE FUNCTION FSFORMATDATE(@aDate as datetime, @aDisplayType as char)\n" + "RETURNS varchar(30)\n" + "AS\n" + "BEGIN\n" + " RETURN case @aDisplayType\n" + " WHEN 'U' THEN CAST(DATEPART(m, @aDate) as varchar) + '/' + DATENAME(d, @aDate) + '/' + DATENAME(yyyy, @aDate)\n" + " WHEN 'B' THEN DATENAME(d, @aDate) + '/' + CAST(DATEPART(m, @aDate) as varchar) + '/' + DATENAME(yyyy, @aDate)\n" + " WHEN 'S' THEN DATENAME(yyyy, @aDate) + '/' + CAST(DATEPART(m, @aDate) as varchar) + '/' + DATENAME(d, @aDate)\n" + " WHEN 'C' THEN DATENAME(yyyy, @aDate) + '/' + CAST(DATEPART(m, @aDate) as varchar) + '/' + DATENAME(d, @aDate)\n" + " WHEN 'E' THEN DATENAME(d, @aDate) + '/' + CAST(DATEPART(m, @aDate) as varchar) + '/' + DATENAME(yyyy, @aDate)\n" + " end\n" + "END\n" + "go\n\n\n\n" + "if objectproperty(object_id('FIND_CUSTOMER'), 'IsView') = 1 \n" + " drop view FIND_CUSTOMER\n" + "go\n\n" + "create view FIND_CUSTOMER as\n" + " select c.CMAR \n" + " ,c.CMACFAX \n" + " ,c.CMACTCNT \n" + " ,c.CMACFONE \n" + " ,c.CMARACNO \n" + " ,c.CMCGACNO \n" + " ,c.CMFTACNO \n" + " ,c.CMSACNO \n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMARCUR, 14, convert(int, m.CLBODY))))) CMARCUR\n" + " ,s.CMARCUR CMARCURFINDERSORT \n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMARHOLD, 14, convert(int, m.CLBODY))))) CMARHOLD \n" + " ,s.CMARHOLD CMARHOLDFINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMAR30, 14, convert(int, m.CLBODY))))) CMAR30 \n" + " ,s.CMAR30 CMAR30FINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMAR60, 14, convert(int, m.CLBODY))))) CMAR60 \n" + " ,s.CMAR60 CMAR60FINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMAR90, 14, convert(int, m.CLBODY))))) CMAR90 \n" + " ,s.CMAR90 CMAR90FINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMARBAL, 14, convert(int, m.CLBODY))))) CMARBAL\n" + " ,s.CMARBAL CMARBALFINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMUNAPCS, 14, convert(int, m.CLBODY))))) CMUNAPCS\n" + " ,s.CMUNAPCS CMUNAPCSFINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMUNAPCR, 14, convert(int, m.CLBODY))))) CMUNAPCR \n" + " ,s.CMUNAPCR CMUNAPCRFINDERSORT\n" + " ,c.CMBANK1 \n" + " ,c.CMBANK2 \n" + " ,c.CMB2AD1 \n" + " ,c.CMB2AD2 \n" + " ,c.CMB2CITY \n" + " ,c.CMB2CNTR \n" + " ,c.CMBILLTO \n" + " ,c.CMB2NAME \n" + " ,c.CMB2STAT \n" + " ,c.CMB2ZIP \n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMBOOK, 14, convert(int, m.CLBODY))))) CMBOOK \n" + " ,s.CMBOOK CMBOOKFINDERSORT\n" + " ,c.CMCARR \n" + " ,c.CMCOMCD \n" + " ,CASE c.CMCNTCUR\n" + " WHEN 'L' THEN convert(nchar,LTRIM(RTRIM(str(s.CMLCRBAL, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar,LTRIM(RTRIM(str(s.CMLCRBAL, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar,LTRIM(RTRIM(str(s.CMLCRBAL, 14, convert(int, q.CURRPRE)))))\n" + " End As CMLCRBAL \n" + " ,s.CMLCRBAL CMLCRBALFINDERSORT\n" + " ,CASE c.CMCNTCUR\n" + " WHEN 'L' THEN convert(nchar,LTRIM(RTRIM(str(c.CMCREDIT, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar,LTRIM(RTRIM(str(c.CMCREDIT, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar,LTRIM(RTRIM(str(c.CMCREDIT, 14, convert(int, q.CURRPRE)))))\n" + " End As CMCREDIT\n" + " ,c.CMCREDIT CMCREDITFINDERSORT\n" + " ,c.CMCRAUTH \n" + " ,dbo.FSFORMATDATE(c.CMCRDATE, SUBSTRING(a.CLBODY,1,1)) CMCRDATE\n" + " ,c.CMCRDATE CMCRDATEFINDERSORT \n" + " ,c.CMACASGN \n" + " ,c.CMACREMV \n" + " ,c.CMCRHOLD \n" + " ,c.CMCRREP \n" + " ,c.CMCSR \n" + " ,c.CMCNTCUR \n" + " ,c.CMCURCOD \n" + " ,c.CMCUAD1 \n" + " ,c.CMCUAD2 \n" + " ,c.CMCUCITY \n" + " ,c.CMCUCNTR \n" + " ,c.CMCUSTAT\n" + " ,c.CMCUZIP \n" + " ,c.CMCLASS\n" + " ,c.CMCLASS$2\n" + " ,c.CMCLASS$3\n" + " ,c.CMCLASS$4\n" + " ,c.CMCLASS$5\n" + " ,c.CMCLASS$6\n" + " ,c.CMCLASL\n" + " ,c.CMCLASL$2\n" + " ,c.CMCONTCT\n" + " ,c.CMFAX\n" + " ,c.CMCUSTID\n" + " ,c.CMCLVL\n" + " ,c.CMCUNAME\n" + " ,c.CMPHONE\n" + " ,c.CMDBSIC\n" + " ,dbo.FSFORMATDATE(c.CMDBDATE, SUBSTRING(a.CLBODY,1,1)) CMDBDATE\n" + " ,c.CMDBDATE CMDBDATEFINDERSORT\n" + " ,c.CMDBRATE\n" + " ,CASE c.CMDBID \n" + " WHEN '' THEN '' ELSE SUBSTRING(c.CMDBID, 1,2) + '-' + SUBSTRING(c.CMDBID,3,3) + '-' + RIGHT(c.CMDBID,4)\n" + " End As CMDBID \n" + " ,c.CMSHCODE\n" + " ,c.CMRTCODE\n" + " ,c.CMEMAIL\n" + " ,c.CMENDUSR\n" + " ,c.CMFOB\n" + " ,c.CMFRTCD\n" + " ,dbo.FSFORMATDATE(s.CMLSTINV, SUBSTRING(a.CLBODY,1,1)) CMLSTINV\n" + " ,s.CMLSTINV CMLSTINVFINDERSORT\n" + " ,dbo.FSFORMATDATE(s.CMLSTPMT, SUBSTRING(a.CLBODY,1,1)) CMLSTPMT\n" + " ,s.CMLSTPMT CMLSTPMTFINDERSORT\n" + " ,c.CMARTYPE\n" + " ,c.CMPALLOC\n" + " ,c.CMPARTL\n" + " ,convert(nchar,LTRIM(RTRIM(str(c.CMTRADE, 7, 1)))) CMTRADE\n" + " ,c.CMTRADE CMTRADEFINDERSORT\n" + " ,c.CMPRNT\n" + " ,c.CMPRTLNG\n" + " ,c.CMPRTFMT\n" + " ,c.CMPAYHOW\n" + " ,c.CMREGION\n" + " ,s.CMSVCHRG\n" + " ,c.CMSTMTCY\n" + " ,c.CMSTMTCD \n" + " ,c.CMSTATUS\n" + " ,c.CMSTKRM\n" + " ,c.CMBIN \n" + " ,convert(nchar,LTRIM(RTRIM(str(c.CMINTRST* 100, 7, 2)))) CMINTRST \n" + " ,c.CMINTRST CMINTRSTFINDERSORT\n" + " ,dbo.FSFORMATDATE(c.CMCADATE, SUBSTRING(a.CLBODY,1,1)) CMCADATE\n" + " ,c.CMCADATE CMCADATEFINDERSORT\n" + " ,c.CMCTXCER \n" + " ,c.CMTXCERT \n" + " ,c.CMMTXCER \n" + " ,c.CMSTXCER \n" + " ,c.CMCTAXCD \n" + " ,c.CMFTAXCD \n" + " ,c.CMMTAXCD\n" + " ,c.CMSTAXCD\n" + " ,c.CMEXC \n" + " ,c.CMEXMPT \n" + " ,c.CMEXM \n" + " ,c.CMEXS \n" + " ,convert(nchar,LTRIM(RTRIM(str(c.CMTRMPC1, 7, 1)))) CMTRMPC1\n" + " ,c.CMTRMPC1 CMTRMPC1FINDERSORT\n" + " ,c.CMTRMDA1 \n" + " ,convert(nchar,LTRIM(RTRIM(str(c.CMTRMPC2, 7, 1)))) CMTRMPC2 \n" + " ,c.CMTRMPC2 CMTRMPC2FINDERSORT \n" + " ,c.CMTRMDA2 \n" + " ,convert(nchar,LTRIM(RTRIM(str(c.CMTRMPC3, 7, 1)))) CMTRMPC3 \n" + " ,c.CMTRMPC3 CMTRMPC3FINDERSORT \n" + " ,c.CMTRMDA3 \n" + " ,convert(nchar,LTRIM(RTRIM(str(c.CMTRMPC4, 7, 1)))) CMTRMPC4\n" + " ,c.CMTRMPC4 CMTRMPC4FINDERSORT \n" + " ,c.CMTRMDA4 \n" + " ,c.CMTRMNET \n" + " ,c.CMCUTOFF \n" + " ,c.CMPAYWEN \n" + " ,c.CMDELAY \n" + " ,n.TXT1 NAME_TEXT1 \n" + " ,n.TXT2 NAME_TEXT2 \n" + " ,n.TXT3 NAME_TEXT3 \n" + " ,n.TXT4 NAME_TEXT4 \n" + " ,n.TXID NAME_TEXT \n" + " ,f.TXT1 FIN_TEXT1 \n" + " ,f.TXT2 FIN_TEXT2 \n" + " ,f.TXT3 FIN_TEXT3 \n" + " ,f.TXT4 FIN_TEXT4 \n" + " ,f.TXID FIN_TEXT \n" + " ,c.CMTOPLVL \n" + " ,c.CMTRCLAS \n" + " ,c.CMVATCUS \n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMYTDPD, 14, convert(int, m.CLBODY))))) CMYTDPD\n" + " ,s.CMYTDPD CMYTDPDFINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMYTDSLS, 14, convert(int, m.CLBODY))))) CMYTDSLS\n" + " ,s.CMYTDSLS CMYTDSLSFINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMYTDPO, 14, convert(int, m.CLBODY))))) CMYTDPO\n" + " ,s.CMYTDPO CMYTDPOFINDERSORT\n" + " ,convert(nchar,LTRIM(RTRIM(str(s.CMYTDSVC, 14, convert(int, m.CLBODY))))) CMYTDSVC \n" + " ,s.CMYTDSVC CMYTDSVCFINDERSORT\n" + " from Mfg_CUSTMAST c\n" + " left join Mfg_SUBCUST s on (s._CUSTSUB_OwnRow = c._Row)\n" + " left join Mfg_DESCTXT_Lnk d on (d._OwnRec = 11 and d._OwnRow = c._Row)\n" + " left join Mfg_TXT f on (f._Row = d._MbrRow)\n" + " left join Mfg_PLNRTXT_Lnk p on (p._OwnRec = 11 and p._OwnRow = c._Row)\n" + " left join Mfg_TXT n on (n._Row = p._MbrRow)\n" + " join Mfg_PARAMETR m on m.CLTYPE = 'DN' and m.CLID = 'PREC'\n" + " join Mfg_PARAMETR a on a.CLTYPE = 'CR' and a.CLID = 'CF01'\n" + " LEFT OUTER JOIN dbo.Mfg_CURRDEF q ON c.CMCURCOD = q.CURRCODE\n" + " with check option\n" + "go\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_CUSTOMER_ORDER\n" + "--\n" + "-- PURPOSE: Used for the Webui. Represents the one to one relationship \n" + "-- between Mfg_ORDMAST and Mfg_SUBORD. Also joins Mfg_CUSTMAST and \n" + "-- MFG_SHIPTO for addresses, as well as Mfg_TXT using Mfg_DESCTXT_Lnk. \n" + "-- Filtered on omtype = 'C' to retrieve only customer orders.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FIND_CUSTOMER_ORDER'), 'IsView') = 1 \n" + " drop view FIND_CUSTOMER_ORDER\n" + "go\n\n" + "create view FIND_CUSTOMER_ORDER as\n" + " select o.OMBILLTO \n" + " ,o.OMON \n" + " ,dbo.FSFORMATDATE(b.OMDATE, SUBSTRING(p.CLBODY,1,1)) OMDATE\n" + " ,b.OMDATE OMDATEFINDERSORT\n" + " ,o.OMCOMCD\n" + " ,o.OMBPSID \n" + " ,o.OMCNTCUR \n" + " ,c.CMCURCOD \n" + " ,c.CMCUAD1 \n" + " ,c.CMCUAD2 \n" + " ,c.CMCUCITY \n" + " ,c.CMCUCNTR \n" + " ,c.CMCUSTAT \n" + " ,c.CMCUZIP \n" + " ,o.OMVCWID \n" + " ,c.CMCUNAME \n" + " ,o.OMCUSREF \n" + " ,dbo.FSFORMATDATE(o.OMDLVYDT, SUBSTRING(p.CLBODY,1,1)) OMDLVYDT \n" + " ,o.OMDLVYDT OMDLVYDTFINDERSORT\n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDISTOT, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDISTOT, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDISTOT, 14, convert(int, q.CURRPRE)))))\n" + " End As OMDISTOT\n" + " ,b.OMDISTOT OMDISTOTFINDERSORT \n" + " ,o.OMDSREG \n" + " ,o.OMDSZONE \n" + " ,o.OMENDUSR \n" + " ,b.OMCURRAT \n" + " ,b.OMCURRT9 \n" + " ,b.OMEXOP \n" + " ,b.OMEXOP9 \n" + " ,dbo.FSFORMATDATE(o.OMEXPDT, SUBSTRING(p.CLBODY,1,1)) OMEXPDT \n" + " ,o.OMEXPDT OMEXPDTFINDERSORT\n" + " ,o.OMFOB \n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMFRTCST, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMFRTCST, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMFRTCST, 14, convert(int, q.CURRPRE)))))\n" + " End As OMFRTCST\n" + " ,b.OMFRTCST OMFRTCSTFINDERSORT \n" + " ,o.OMFRTCD \n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMGROSS, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMGROSS, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMGROSS, 14, convert(int, q.CURRPRE)))))\n" + " End As OMGROSS\n" + " ,b.OMGROSS OMGROSSFINDERSORT \n" + " ,o.OMPAYCD \n" + " ,o.OMHOLD \n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMBOOK, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMBOOK, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMBOOK, 14, convert(int, q.CURRPRE)))))\n" + " End As OMBOOK \n" + " ,b.OMBOOK OMBOOKFINDERSORT \n" + " ,o.OMPRIOR \n" + " ,b.OMORDST \n" + " ,convert(nchar, LTRIM(RTRIM(str(o.OMTRADE, 7, 1)))) OMTRADE\n" + " ,o.OMTRADE OMTRADEFINDERSORT \n" + " ,o.OMPRPOST \n" + " ,o.OMREGION \n" + " ,o.OMSCAT1 \n" + " ,o.OMSCAT2 \n" + " ,s.STAD1 \n" + " ,s.STAD2 \n" + " ,s.STCITY \n" + " ,s.STCNTR \n" + " ,o.OMSTID \n" + " ,o.OMSHPCUS \n" + " ,s.STNAME \n" + " ,s.STSTAT \n" + " ,s.STZIP \n" + " ,o.OMVIA \n" + " ,o.OMMLTITM \n" + " ,o.OMMLTSHP \n" + " ,o.OMPARITM \n" + " ,o.OMTMPLFG \n" + " ,convert(nchar,LTRIM(RTRIM(str(o.OMTRMPC1, 7, 1)))) OMTRMPC1\n" + " ,o.OMTRMPC1 OMTRMPC1FINDERSORT \n" + " ,o.OMTRMDA1 \n" + " ,convert(nchar,LTRIM(RTRIM(str(o.OMTRMPC2, 7, 1)))) OMTRMPC2\n" + " ,o.OMTRMPC2 OMTRMPC2FINDERSORT \n" + " ,o.OMTRMDA2 \n" + " ,convert(nchar,LTRIM(RTRIM(str(o.OMTRMPC3, 7, 1)))) OMTRMPC3\n" + " ,o.OMTRMPC3 OMTRMPC3FINDERSORT \n" + " ,o.OMTRMDA3 \n" + " ,convert(nchar,LTRIM(RTRIM(str(o.OMTRMPC4, 7, 1)))) OMTRMPC4 \n" + " ,o.OMTRMPC4 OMTRMPC4FINDERSORT \n" + " ,o.OMTRMDA4 \n" + " ,o.OMTRMNET\n" + " ,o.OMPAYWEN \n" + " ,o.OMCUTOFF \n" + " ,o.OMDELAY \n" + " ,o.OMPAYHOW \n" + " ,t.TXT1 \n" + " ,t.TXT2\n" + " ,t.TXT3\n" + " ,t.TXT4\n" + " ,t.TXID\n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDOLVAL, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDOLVAL, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDOLVAL, 14, convert(int, q.CURRPRE)))))\n" + " End As OMDOLVAL\n" + " ,b.OMDOLVAL OMDOLVALFINDERSORT \n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMORDTOT, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMORDTOT, 14, convert(int,m.CLBODY )))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMORDTOT, 14, convert(int, m.CLBODY)))))\n" + " End As OMORDTOT\n" + " ,b.OMORDTOT OMORDTOTFINDERSORT \n" + " from Mfg_ORDMAST o\n" + " left join Mfg_SUBORD b on (b._ORDSUB_OwnRow = o._Row)\n" + " left join Mfg_CUSTMAST c on (o.OMVCWID = c.CMCUSTID)\n" + " left join Mfg_SHIPTO s on (o._ORDSADD_OwnRow = s._Row) \n" + " left join Mfg_DESCTXT_Lnk d on (d._OwnRec = 29 and d._OwnRow = o._Row)\n" + " left join Mfg_TXT t on (t._Row = d._MbrRow)\n" + " join Mfg_PARAMETR m on m.CLTYPE = 'DN' and m.CLID = 'PREC'\n" + " join Mfg_PARAMETR p on p.CLTYPE = 'CR' and p.CLID = 'CF01'\n" + " LEFT OUTER JOIN dbo.Mfg_CURRDEF q ON c.CMCURCOD = q.CURRCODE\n" + " where o.OMTYPE = 'C'\n" + " with check option\n" + "go\n\n\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_ITEM\n" + "--\n" + "-- PURPOSE: Used for the Webui. Represents the one to one relationship \n" + "-- between Mfg_ITMMAST and Mfg_SUBITEM. Also joins Mfg_LOTITM which is\n" + "-- a one to one relationship with Mfg_ITMMAST. No filtering done, this \n" + "-- view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FIND_ITEM'), 'IsView') = 1 \n" + " drop view FIND_ITEM\n" + "go\n\n" + "create view FIND_ITEM as\n" + " select i.IMCGACNO\n" + " ,i.IMACCTNO\n" + " ,i.IMSACNO\n" + " ,s.IMALLOC\n" + " ,i.IMATPPOL\n" + " ,i.IMPRICE\n" + " ,i.IMBUYR\n" + " ,i.IMCSTFAM\n" + " ,s.IMCYLDAT\n" + " ,i.IMDECPRE\n" + " ,i.IMDEMFNC\n" + " ,i.IMDRWG\n" + " ,i.IMECCN\n" + " ,i.IMFGROUP\n" + " ,i.IMFAMILY\n" + " ,i.IMFORCON\n" + " ,i.IMFORCPD\n" + " ,i.IMGATEWC\n" + " ,i.IMGRPTCH\n" + " ,i.IMDOC\n" + " ,i.IMINSPCD\n" + " ,i.IMPN\n" + " ,i.IMCLAS1\n" + " ,i.IMCLAS2\n" + " ,i.IMCLAS3\n" + " ,i.IMCLAS4\n" + " ,i.IMCLAS5\n" + " ,i.IMCLAS6\n" + " ,i.IMCLAS7\n" + " ,i.IMCLAS8\n" + " ,i.IMDESC\n" + " ,i.IMPCSPER\n" + " ,i.IMPKGTYP\n" + " ,i.IMREF1\n" + " ,i.IMREF2\n" + " ,i.IMLTL\n" + " ,i.IMTL\n" + " ,i.IMREF\n" + " ,i.IMCUBEFT\n" + " ,i.IMWEIGHT\n" + " ,i.IMLTFXD\n" + " ,i.IMLTQA\n" + " ,i.IMLTVAR\n" + " ,i.IMLOTDAY\n" + " ,i.IMLOTMN\n" + " ,i.IMLOTML\n" + " ,i.IMLOTSZ\n" + " ,l.IMALLPOL\n" + " ,l.IMLOTPOL\n" + " ,l.IMAVLDAY\n" + " ,l.IMLOTNUM\n" + " ,l.IMLOTDEF\n" + " ,l.IMFIFOPL\n" + " ,l.IMLSTLOT\n" + " ,l.IMLSTSER\n" + " ,l.IMLOTMSK\n" + " ,l.IMMATCD\n" + " ,l.IMRETEST\n" + " ,l.IMSERDEF\n" + " ,l.IMSERMSK\n" + " ,i.IMSERIAL\n" + " ,l.IMSHELF\n" + " ,i.IMPOTENT\n" + " ,i.IMLOTTR\n" + " ,s.IMLLCD\n" + " ,i.IMMKBY\n" + " ,i.IMNMF\n" + " ,i.IMNMFSC\n" + " ,i.IMORDPOL\n" + " ,i.IMPLNR\n" + " ,i.IMPLNFNC\n" + " ,i.IMPLNPOL\n" + " ,i.IMBIN\n" + " ,i.IMSTKRM\n" + " ,r.PLPRDLN\n" + " ,r.PLDESC\n" + " ,s.IMREPLN\n" + " ,dbo.FSFORMATDATE(i.IMLRPLDT, SUBSTRING(p.CLBODY,1,1)) IMLRPLDT\n" + " ,i.IMLRPLDT IMLRPLDTFINDERSORT\n" + " ,i.IMREV\n" + " ,i.IMSS\n" + " ,i.IMCORP\n" + " ,i.IMCSTSU\n" + " ,i.IMSTAT\n" + " ,i.IMTYPE\n" + " ,i.IMUM\n" + " ,i.IMUPCCD\n" + " ,i.IMYIELD\n" + " from Mfg_ITMMAST i\n" + " left join Mfg_SUBITEM s on (s._ITMSUB_OwnRow = i._Row)\n" + " left join Mfg_LOTITM l on (l._ITMLOT_OwnRow = i._Row)\n" + " left join Mfg_PRODLINE r on (i._PRODIT_OwnRow = r._Row)\n" + " join Mfg_PARAMETR p on p.CLTYPE = 'CR' and p.CLID = 'CF01'\n" + " with check option\n" + "go \n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_LOT\n" + "--\n" + "-- PURPOSE: Used for the Webui. Basically includes all of the fields from\n" + "-- Mfg_INCONTRL table. Joins to the Mfg_ITMMAST table to get the\n" + "-- corresponding Item Number for this Lot. Also joins to the Mfg_LOTITM\n" + "-- table to get the corresponding Lot Number Mask. \n" + "-- No filtering is done, this view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FIND_LOT'), 'IsView') = 1 \n" + " drop view FIND_LOT\n" + "go\n\n" + "create view FIND_LOT as\n" + " select c.INCTLNUM\n" + " ,i.IMPN\n" + " ,c.INDESC\n" + " ,c.INREV\n" + " ,l.IMLOTMSK\n" + " ,c.INVENLOT\n" + " ,c.INUSER1\n" + " ,c.INUSER2\n" + " ,c.INUSER3\n" + " ,c.INUSER4\n" + " ,c.INUSER5\n" + " ,c.INUSER6\n" + " ,c.INUSER7\n" + " ,c.INUSER8\n" + " ,c.INUSER9\n" + " ,c.INUSER10\n" + " ,c.INUSER11\n" + " ,c.INUSER12\n" + " from Mfg_INCONTRL c\n" + " left join Mfg_ITMMAST i on (c._ITMINC_OwnRow = i._Row)\n" + " left join Mfg_LOTITM l on (i._Row = l._ITMLOT_OwnRow)\n" + " with check option\n" + "go \n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_MANUFACTURING_ORDER\n" + "--\n" + "-- PURPOSE: Used for the Webui. Represents the one to one relationship \n" + "-- between Mfg_ORDMAST and Mfg_SUBORD. Also joins Mfg_TXT using \n" + "-- Mfg_DESCTXT_Lnk. Filtered on omtype = 'M' to retrieve only \n" + "-- manufacturing orders.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FIND_MANUFACTURING_ORDER'), 'IsView') = 1 \n" + " drop view FIND_MANUFACTURING_ORDER\n" + "go\n\n" + "create view FIND_MANUFACTURING_ORDER as\n" + " select o.OMFOB \n" + " ,o.OMVCWID \n" + " ,o.OMON \n" + " ,dbo.FSFORMATDATE(b.OMDATE, SUBSTRING(p.CLBODY,1,1)) OMDATE\n" + " ,b.OMDATE OMDATEFINDERSORT \n" + " ,b.OMORDST \n" + " ,o.OMBPSID \n" + " ,t.TXT1 \n" + " ,t.TXT2\n" + " ,t.TXT3\n" + " ,t.TXT4\n" + " ,t.TXID\n" + " from Mfg_ORDMAST o\n" + " left join Mfg_SUBORD b on (b._ORDSUB_OwnRow = o._Row)\n" + " left join Mfg_DESCTXT_Lnk d on (d._OwnRec = 29 and d._OwnRow = o._Row)\n" + " join Mfg_PARAMETR p on p.CLTYPE = 'CR' and p.CLID = 'CF01'\n" + " left join Mfg_TXT t on (t._Row = d._MbrRow)\n" + " where o.OMTYPE = 'M'\n" + " with check option\n" + "go\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_PURCHASE_ORDER\n" + "--\n" + "-- PURPOSE: Used for the Webui. Represents the one to one relationship \n" + "-- between Mfg_ORDMAST and Mfg_SUBORD. Also joins Mfg_CUSTMAST and \n" + "-- MFG_SHIPTO for addresses, as well as Mfg_TXT using Mfg_DESCTXT_Lnk. \n" + "-- Filtered on omtype = 'P' to retrieve only purchase orders.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FIND_PURCHASE_ORDER'), 'IsView') = 1 \n" + " drop view FIND_PURCHASE_ORDER\n" + "go\n\n" + "create view FIND_PURCHASE_ORDER as\n" + " select o.OMSUBTYP\n" + " ,o.OMBPSID \n" + " ,o.OMCNTCUR \n" + " ,v.VMCURCOD \n" + " ,b.OMCURRAT \n" + " ,b.OMCURRT9 \n" + " ,b.OMEXOP \n" + " ,b.OMEXOP9 \n" + " ,o.OMFOB \n" + " ,o.OMPHONE \n" + " ,o.OMCNTACT \n" + " ,b.OMORDST \n" + " ,dbo.FSFORMATDATE(o.OMORGDTE, SUBSTRING(p.CLBODY,1,1)) OMORGDTE\n" + " ,o.OMORGDTE OMORGDTEFINDERSORT\n" + " ,o.OMON \n" + " ,o.OMREV \n" + " ,o.OMPRTPO \n" + " ,dbo.FSFORMATDATE(b.OMDATE, SUBSTRING(p.CLBODY,1,1)) OMDATE \n" + " ,b.OMDATE OMDATEFINDERSORT \n" + " ,o.OMS2AD1 \n" + " ,o.OMS2AD2 \n" + " ,o.OMS2CITY \n" + " ,o.OMS2CNTR \n" + " ,o.OMS2NAME \n" + " ,o.OMS2STAT \n" + " ,o.OMS2ZIP \n" + " ,convert(nchar,LTRIM(RTRIM(str(o.OMTRMPC1, 7, 1)))) OMTRMPC1\n" + " ,o.OMTRMPC1 OMTRMPC1FINDERSORT\n" + " ,o.OMTRMDA1\n" + " ,convert(nchar,LTRIM(RTRIM(str(o.OMTRMPC2, 7, 1)))) OMTRMPC2 \n" + " ,o.OMTRMPC2 OMTRMPC2FINDERSORT\n" + " ,o.OMTRMDA2 \n" + " ,o.OMTRMNET\n" + " ,o.OMPAYWEN \n" + " ,o.OMCUTOFF \n" + " ,o.OMDELAY \n" + " ,o.OMPAYHOW \n" + " ,t.TXT1 \n" + " ,t.TXT2\n" + " ,t.TXT3\n" + " ,t.TXT4\n" + " ,t.TXID\n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDOLVAL, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDOLVAL, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMDOLVAL, 14, convert(int, q.CURRPRE)))))\n" + " End As OMDOLVAL\n" + " ,b.OMDOLVAL OMDOLVALFINDERSORT \n" + " ,CASE o.OMCNTCUR\n" + " WHEN 'F' THEN convert(nchar, LTRIM(RTRIM(str(b.OMORDTOT, 14, convert(int, m.CLBODY)))))\n" + " WHEN 'R' THEN convert(nchar, LTRIM(RTRIM(str(b.OMORDTOT, 14, convert(int, q.CURRPRE)))))\n" + " WHEN 'L' THEN convert(nchar, LTRIM(RTRIM(str(b.OMORDTOT, 14, convert(int, q.CURRPRE)))))\n" + " End As OMORDTOT\n" + " ,b.OMORDTOT OMORDTOTFINDERSORT\n" + " ,o.OMVIA\n" + " ,v.VMVENID\n" + " ,v.VMVENAME \n" + " from Mfg_ORDMAST o\n" + " left join Mfg_SUBORD b on (b._ORDSUB_OwnRow = o._Row)\n" + " left join Mfg_VENMAST v on (o.OMVCWID = v.VMVENID)\n" + " left join Mfg_DESCTXT_Lnk d on (d._OwnRec = 29 and d._OwnRow = o._Row)\n" + " left join Mfg_TXT t on (t._Row = d._MbrRow)\n" + " join Mfg_PARAMETR m on m.CLTYPE = 'DN' and m.CLID = 'PREC'\n" + " join Mfg_PARAMETR p on p.CLTYPE = 'CR' and p.CLID = 'CF01'\n" + " LEFT OUTER JOIN dbo.Mfg_CURRDEF q ON v.VMCURCOD = q.CURRCODE\n" + " where o.OMTYPE = 'P'\n" + " with check option\n" + "go\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: FIND_VENDOR\n" + "--\n" + "-- PURPOSE: Used for the Webui. Represents the one to one relationship\n" + "-- between Mfg_VENMAST and Mfg_SUBVEN. Also joins Mfg_TXT using \n" + "-- Mfg_DESCTXT_Lnk and Mfg_PLNRTXT_Lnk. No filtering done, \n" + "-- this view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('FIND_VENDOR'), 'IsView') = 1 \n" + " drop view FIND_VENDOR\n" + "go\n\n" + "create view FIND_VENDOR as\n" + " select v.VMTXFG \n" + " ,v.VMTIN \n" + " ,v.VMACTCNT \n" + " ,v.VMACFONE\n" + " ,convert(nchar, LTRIM(RTRIM(str((s.VMCURR + s.VMFUT + s.VMFUT1 + s.VMFUT2 + s.VMFUT3), 14,convert(int, m.CLBODY))))) VMCURR\n" + " ,s.VMCURR + s.VMFUT + s.VMFUT1 + s.VMFUT2 + s.VMFUT3 VMCURRFINDERSORT\n" + " ,v.VMEMAIL\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMFUT, 14 , convert(int, m.CLBODY))))) VMFUT \n" + " ,s.VMFUT VMFUTFINDERSORT \n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMFUT1, 14 ,convert(int, m.CLBODY))))) VMFUT1\n" + " ,s.VMFUT1 VMFUT1FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMFUT2, 14 ,convert(int, m.CLBODY))))) VMFUT2\n" + " ,s.VMFUT2 VMFUT2FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMFUT3, 14 ,convert(int, m.CLBODY))))) VMFUT3 \n" + " ,s.VMFUT3 VMFUT3FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMHOLD, 14 ,convert(int, m.CLBODY))))) VMHOLD\n" + " ,s.VMHOLD VMHOLDFINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMPAST1, 14 ,convert(int, m.CLBODY))))) VMPAST1 \n" + " ,s.VMPAST1 VMPAST1FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMPAST2, 14, convert(int, m.CLBODY))))) VMPAST2\n" + " ,s.VMPAST2 VMPAST2FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMPAST3, 14, convert(int, m.CLBODY))))) VMPAST3 \n" + " ,s.VMPAST3 VMPAST3FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMCURR + s.VMFUT + s.VMFUT1 + s.VMFUT2 + s.VMFUT3 + s.VMPAST1 + s.VMPAST2 + s.VMPAST3 + VMHOLD\n" + " - s.VMUNAPP, 14, convert(int, m.CLBODY))))) VMTOTAMT \n" + " ,s.VMCURR + s.VMFUT + s.VMFUT1 + s.VMFUT2 + s.VMFUT3 + s.VMPAST1 + s.VMPAST2 + s.VMPAST3 + VMHOLD\n" + " - s.VMUNAPP VMTOTAMTFINDERSORT \n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMUNAPP, 14, convert(int, m.CLBODY))))) VMUNAPP \n" + " ,s.VMUNAPP VMUNAPPFINDERSORT\n" + " ,v.VMBANKAC \n" + " ,v.VMBANKNM \n" + " ,v.VMBANKRT \n" + " ,v.VMCNTCUR \n" + " ,v.VMCURCOD \n" + " ,v.VMDBSIC \n" + " ,dbo.FSFORMATDATE(v.VMDBDATE, SUBSTRING(a.CLBODY,1,1)) VMDBDATE\n" + " ,v.VMDBDATE VMDBDATEFINDERSORT\n" + " ,v.VMDBRATE \n" + " ,CASE v.VMDBID \n" + " WHEN '' THEN '' ELSE SUBSTRING(v.VMDBID, 1,2) + '-' + SUBSTRING(v.VMDBID,3,3) + '-' + RIGHT(v.VMDBID,5)\n" + " End As VMDBID \n" + " ,dbo.FSFORMATDATE(s.VMLSTINV, SUBSTRING(a.CLBODY,1,1)) VMLSTINV \n" + " ,s.VMLSTINV VMLSTINVFINDERSORT \n" + " ,dbo.FSFORMATDATE(v.VMLSTMNT, SUBSTRING(a.CLBODY,1,1)) VMLSTMNT\n" + " ,v.VMLSTMNT VMLSTMNTFINDERSORT \n" + " ,dbo.FSFORMATDATE(s.VMLSTPMT, SUBSTRING(a.CLBODY,1,1)) VMLSTPMT \n" + " ,s.VMLSTPMT VMLSTPMTFINDERSORT\n" + " ,dbo.FSFORMATDATE(s.VMRCPDT, SUBSTRING(a.CLBODY,1,1)) VMRCPDT\n" + " ,s.VMRCPDT VMRCPDTFINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMORD, 14, convert(int, m.CLBODY))))) VMORD\n" + " ,s.VMORD VMORDFINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMORD2, 14, convert(int, m.CLBODY))))) VMORD2 \n" + " ,s.VMORD2 VMORD2FINDERSORT\n" + " ,v.VMP2AD1 \n" + " ,v.VMP2AD2 \n" + " ,v.VMP2CITY \n" + " ,v.VMP2CNTR \n" + " ,v.VMP2NAME \n" + " ,v.VMP2NAM2 \n" + " ,v.VMP2STAT \n" + " ,v.VMP2ZIP \n" + " ,v.VMPAYCOD \n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMYTDPD, 14, convert(int, m.CLBODY))))) VMYTDPD\n" + " ,s.VMYTDPD VMYTDPDFINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str (s.VMYTPD2, 14, convert(int, m.CLBODY))))) VMYTPD2 \n" + " ,s.VMYTPD2 VMYTPD2FINDERSORT\n" + " ,v.VMUNVAP\n" + " ,v.VMVCHAP\n" + " ,v.VMPPVAR\n" + " ,v.VMPOINVR\n" + " ,v.VMPOPRNT \n" + " ,v.VMPRTLNG \n" + " ,v.VMPRTFMT \n" + " ,v.VMPAYHOW \n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMYTDPO, 14, convert(int, m.CLBODY))))) VMYTDPO\n" + " ,s.VMYTDPO VMYTDPOFINDERSORT\n" + " ,dbo.FSFORMATDATE(v.VMVADATE, SUBSTRING(a.CLBODY,1,1)) VMVADATE\n" + " ,v.VMVADATE VMVADATEFINDERSORT\n" + " ,v.VMSTATUS\n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMYTPO2, 14, convert(int, m.CLBODY))))) VMYTPO2 \n" + " ,s.VMYTPO2 VMYTPO2FINDERSORT\n" + " ,convert(nchar, LTRIM(RTRIM(str(v.VMTRMPC1, 7, 1)))) VMTRMPC1\n" + " ,v.VMTRMPC1 VMTRMPC1FINDERSORT\n" + " ,v.VMTRMDA1 \n" + " ,convert(nchar,LTRIM(RTRIM(str(v.VMTRMPC2, 7, 1)))) VMTRMPC2 \n" + " ,v.VMTRMPC2 VMTRMPC2FINDERSORT\n" + " ,v.VMTRMDA2 \n" + " ,v.VMTRMNET \n" + " ,v.VMCUTOFF \n" + " ,v.VMPAYWEN \n" + " ,v.VMDELAY \n" + " ,t.TXT1 TEXT_LINE1 \n" + " ,t.TXT2 TEXT_LINE2 \n" + " ,t.TXT3 TEXT_LINE3\n" + " ,t.TXT4 TEXT_LINE4 \n" + " ,t.TXID TEXT_NO \n" + " ,c.TXT1 CONF_TEXT1 \n" + " ,c.TXT2 CONF_TEXT2 \n" + " ,c.TXT3 CONF_TEXT3 \n" + " ,c.TXT4 CONF_TEXT4 \n" + " ,c.TXID CONF_TEXTNO \n" + " ,v.VMVEAD1 \n" + " ,v.VMVEAD2 \n" + " ,v.VMVECITY\n" + " ,v.VMVECNTR \n" + " ,v.VMVESTAT \n" + " ,v.VMVEZIP \n" + " ,v.VMSTAT\n" + " ,v.VMCLASS \n" + " ,v.VMCLASS$2 \n" + " ,v.VMCLASS$3 \n" + " ,v.VMCLASS$4 \n" + " ,v.VMCLASS$5 \n" + " ,v.VMCLASS$6 \n" + " ,v.VMCLASL \n" + " ,v.VMCLASL$2 \n" + " ,v.VMCONTCT \n" + " ,v.VMFAX \n" + " ,v.VMVENID \n" + " ,v.VMVENAME \n" + " ,v.VMPHONE \n" + " ,convert(nchar, LTRIM(RTRIM(str(s.VMYTDINV, 14, convert(int, m.CLBODY))))) VMYTDINV\n" + " ,s.VMYTDINV VMYTDINVFINDERSORT \n" + " from Mfg_VENMAST v\n" + " left join Mfg_SUBVEN s on (s._VENSUB_OwnRow = v._Row)\n" + " left join Mfg_DESCTXT_Lnk d on (d._OwnRec = 59 and d._OwnRow = v._Row)\n" + " left join Mfg_TXT t on (t._Row = d._MbrRow)\n" + " left join Mfg_PLNRTXT_Lnk p on (p._OwnRec = 59 and p._OwnRow = v._Row)\n" + " left join Mfg_TXT c on (c._Row = p._MbrRow)\n" + " join Mfg_PARAMETR m on m.CLTYPE = 'DN' and m.CLID = 'PREC'\n" + " join Mfg_PARAMETR a on a.CLTYPE = 'CR' and a.CLID = 'CF01'\n" + " with check option\n\n" + "go\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: GL_MASTER\n" + "--\n" + "-- PURPOSE: Represents the one to one relationship between Fin_GLMASTER and\n" + "-- Fin_SUBMAST. No filtering done, this view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('GL_MASTER'), 'IsView') = 1 \n" + " drop view GL_MASTER\n" + "go\n\n" + "create view GL_MASTER as\n" + " select g.GMACTNO \n" + " ,g.GMACTCAT \n" + " ,g.GMACTYPE \n" + " ,g.GMACTBAL \n" + " ,g.GMPRDDB \n" + " ,g.GMPRDCR \n" + " ,g.GMCNETDB \n" + " ,g.GMCNETCR \n" + " ,g.GMPNETDB \n" + " ,g.GMPNETCR \n" + " ,g.GMLSTPST \n" + " ,g._Row GLMASTER_Row \n" + " ,g._GLORGMST_OwnRow \n" + " ,g._GLVALMST_OwnRow \n" + " ,g._SYSNET_OwnRow \n" + " ,g._Ts GLMASTER_Ts \n" + " ,s.GMCACTNO \n" + " ,s.GMACTDSC \n" + " ,s.GMORGDSC \n" + " ,s.GMCLOFLG \n" + " ,s.GMICTFLG \n" + " ,s.GMBALLMT \n" + " ,s.GMTRNLMT \n" + " ,s.GMMDATA \n" + " ,s.GMMDATA$2 \n" + " ,s.GMMDATA$3 \n" + " ,s.GMMDATA$4 \n" + " ,s.GMMDATA$5 \n" + " ,s.GMMDATA$6 \n" + " ,s.GMMAMNT \n" + " ,s.GMMAMNT$2 \n" + " ,s.GMMAMNT$3 \n" + " ,s.GMMAMNT$4 \n" + " ,s.GMMAMNT$5 \n" + " ,s.GMMAMNT$6 \n" + " ,s.GMLSTMNT \n" + " ,s.GMACTUSR \n" + " ,s.GMOIAFLG \n" + " ,s.GMAIFLAG \n" + " ,s._Row SUBMAST_Row \n" + " ,s._MASTSUB_OwnRow \n" + " ,s._Ts SUBMAST_Ts\n" + " from Fin_GLMASTER g\n" + " left join Fin_SUBMAST s on (s._MASTSUB_OwnRow = g._Row)\n" + " with check option\n" + "go\n\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: ITEM_MASTER\n" + "--\n" + "-- PURPOSE: Represents the one to one relationship between Mfg_ITMMAST and\n" + "-- Mfg_SUBITEM. No filtering done, this view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('ITEM_MASTER'), 'IsView') = 1 \n" + " drop view ITEM_MASTER\n" + "go\n\n" + "create view ITEM_MASTER as\n" + " select i.IMPN \n" + " ,i.IMDESC \n" + " ,i.IMTYPE \n" + " ,i.IMUM \n" + " ,i.IMCLAS1 \n" + " ,i.IMCLAS2 \n" + " ,i.IMCLAS3 \n" + " ,i.IMCLAS4 \n" + " ,i.IMCLAS5 \n" + " ,i.IMCLAS6 \n" + " ,i.IMCLAS7 \n" + " ,i.IMCLAS8 \n" + " ,i.IMMKBY \n" + " ,i.IMSTAT \n" + " ,i.IMDRWG \n" + " ,i.IMREV \n" + " ,i.IMPLNR \n" + " ,i.IMBUYR \n" + " ,i.IMACCTNO \n" + " ,i.IMCSTSU \n" + " ,i.IMPRICE \n" + " ,i.IMORDPOL \n" + " ,i.IMYIELD \n" + " ,i.IMDECPRE \n" + " ,i.IMLOTSZ \n" + " ,i.IMSS \n" + " ,i.IMLTFXD \n" + " ,i.IMLTVAR \n" + " ,i.IMLTQA \n" + " ,i.IMFORCON \n" + " ,i.IMPLNPOL \n" + " ,i.IMLOTMN \n" + " ,i.IMLOTML \n" + " ,i.IMLOTDAY \n" + " ,i.IMSTKRM \n" + " ,i.IMBIN \n" + " ,i.IMCORP \n" + " ,i.IMINSPCD \n" + " ,i.IMATPPOL \n" + " ,i.IMDEMFNC \n" + " ,i.IMPLNFNC \n" + " ,i.IMFORCPD \n" + " ,i.IMLRPLDT \n" + " ,i.IMGATEWC \n" + " ,i.IMLTL \n" + " ,i.IMTL\n" + " ,i.IMREF \n" + " ,i.IMGRPTCH \n" + " ,i.IMFAMILY \n" + " ,i.IMFGROUP \n" + " ,i.IMNMF \n" + " ,i.IMNMFSC \n" + " ,i.IMWEIGHT \n" + " ,i.IMCUBEFT \n" + " ,i.IMSACNO \n" + " ,i.IMCGACNO \n" + " ,i.IMCSTFAM \n" + " ,i.IMUPCCD \n" + " ,i.IMPKGTYP \n" + " ,i.IMPCSPER \n" + " ,i.IMREF1 \n" + " ,i.IMREF2 \n" + " ,i.IMPLNDAT \n" + " ,i.IMLOTTR \n" + " ,i.IMSERIAL \n" + " ,i.IMPOTENT \n" + " ,i.IMFIFO \n" + " ,i.IMLTOVL \n" + " ,i.IMLTFXD2 \n" + " ,i.IMVATPRD \n" + " ,i.IMCURCOD \n" + " ,i.IMFORAMT \n" + " ,i.IMECCN \n" + " ,i.IMDOC \n" + " ,i.IMCURCTL \n" + " ,i.IMCURRAT \n" + " ,i.IMPLNVIS \n" + " ,i.IMXRACNO \n" + " ,i.IMXCACNO \n" + " ,i.IMWEACNO \n" + " ,i._Row ITMMAST_Row \n" + " ,i._Ts ITMMAST_Ts\n" + " ,s.IMLSTVEN \n" + " ,s.IMLLCD \n" + " ,s.IMOHQTY \n" + " ,s.IMIIQTY \n" + " ,s.IMHOQTY \n" + " ,s.IMSHQTY \n" + " ,s.IMWIPQTY \n" + " ,s.IMALLOC \n" + " ,s.IMREPLN \n" + " ,s.IMYTDRCV \n" + " ,s.IMYTDDOL \n" + " ,s.IMOO \n" + " ,s.IMATPQTY \n" + " ,s.IMEXTWIP \n" + " ,s.IMOHACT \n" + " ,s.IMIIACT \n" + " ,s.IMYTDISS \n" + " ,s.IMYTDSHP \n" + " ,s.IMCYLDAT \n" + " ,s._Row SUBITEM_Row \n" + " ,s._ITMSUB_OwnRow \n" + " ,s._Ts SUBITEM_Ts\n" + " from Mfg_ITMMAST i\n" + " left join Mfg_SUBITEM s on (s._ITMSUB_OwnRow = i._Row)\n" + " with check option\n" + "go \n" + "--------------------------------------------------------------------------------\n" + "-- NAME: ORDER_MASTER\n" + "--\n" + "-- PURPOSE: Represents the one to one relationship between Mfg_ORDMAST and\n" + "-- Mfg_SUBORD. No filtering done, this view includes all rows.\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('ORDER_MASTER'), 'IsView') = 1 \n" + " drop view ORDER_MASTER\n" + "go\n\n" + "create view ORDER_MASTER as\n" + " select o.OMTYPE \n" + " ,o.OMON \n" + " ,o.OMVCWID \n" + " ,o.OMBPSID \n" + " ,o.OMVIA \n" + " ,o.OMTRMPC1 \n" + " ,o.OMTRMDA1 \n" + " ,o.OMTRMPC2 \n" + " ,o.OMTRMDA2 \n" + " ,o.OMTRMNET \n" + " ,o.OMTRADE \n" + " ,o.OMFOB \n" + " ,o.OMFRTCD \n" + " ,o.OMPAYCD \n" + " ,o.OMCUSREF \n" + " ,o.OMS2NAME \n" + " ,o.OMS2AD1 \n" + " ,o.OMS2AD2 \n" + " ,o.OMS2CITY \n" + " ,o.OMS2STAT \n" + " ,o.OMS2CNTR \n" + " ,o.OMS2ZIP \n" + " ,o.OMCOMCD \n" + " ,o.OMSCAT1 \n" + " ,o.OMSCAT2 \n" + " ,o.OMEXMPT \n" + " ,o.OMTXCERT \n" + " ,o.OMFTAXCD \n" + " ,o.OMSTAXCD \n" + " ,o.OMCTAXCD \n" + " ,o.OMMTAXCD \n" + " ,o.OMSTID \n" + " ,o.OMCLASS \n" + " ,o.OMCLASS$2 \n" + " ,o.OMCLASS$3 \n" + " ,o.OMCLASS$4 \n" + " ,o.OMCLASS$5 \n" + " ,o.OMCLASS$6 \n" + " ,o.OMCLASL \n" + " ,o.OMCLASL$2 \n" + " ,o.OMCNTCUR \n" + " ,o.OMPAYHOW \n" + " ,o.OMPAYWEN \n" + " ,o.OMCUTOFF \n" + " ,o.OMDELAY \n" + " ,o.OMREV \n" + " ,o.OMORGDTE \n" + " ,o.OMSUBTYP \n" + " ,o.OMPRTPO \n" + " ,o.OMCNTACT \n" + " ,o.OMPHONE \n" + " ,o.OMOCURR \n" + " ,o.OMOCURAT \n" + " ,o.OMLTRCRD \n" + " ,o.OMORGINS \n" + " ,o.OMORGINN \n" + " ,o.OMEDIOUT \n" + " ,o.OMEDIACK \n" + " ,o.OMEDIIN \n" + " ,o.OMRELNO \n" + " ,o.OMHOLD \n" + " ,o.OMDLVYDT \n" + " ,o.OMEXPDT \n" + " ,o.OMENDUSR \n" + " ,o.OMBILLTO \n" + " ,o.OMPRIOR \n" + " ,o.OMSEXMPT \n" + " ,o.OMCEXMPT \n" + " ,o.OMMEXMPT \n" + " ,o.OMOEXMPT \n" + " ,o.OMOTAXCD \n" + " ,o.OMTMPLFG \n" + " ,o.OMTRMPC3 \n" + " ,o.OMTRMDA3 \n" + " ,o.OMTRMPC4 \n" + " ,o.OMTRMDA4 \n" + " ,o.OMSHPCUS \n" + " ,o.OMREGION \n" + " ,o.OMDSZONE \n" + " ,o.OMDSREG \n" + " ,o.OMSTXCER \n" + " ,o.OMCTXCER \n" + " ,o.OMMTXCER \n" + " ,o.OMOTXCER \n" + " ,o.OMMLTSHP \n" + " ,o.OMPARITM \n" + " ,o.OMMLTITM \n" + " ,o.OMDFTSTA \n" + " ,o.OMPRPOST \n" + " ,o._Row ORDMAST_Row\n" + " ,o._CTRTORD_OwnRow \n" + " ,o._ORDSADD_OwnRow \n" + " ,o._SYSORDPR_OwnRec \n" + " ,o._SYSTPORD_OwnRec \n" + " ,o._VCORD_OwnRow \n" + " ,o._VCORD_OwnRec \n" + " ,o._Ts ORDMAST_Ts\n" + " ,s.OMDATE \n" + " ,s.OMORDST \n" + " ,s.OMCLSCNT \n" + " ,s.OMDOLVAL \n" + " ,s.OMRCPTFG \n" + " ,s.LINENUM \n" + " ,s.OMMU1 \n" + " ,s.OMMU2 \n" + " ,s.OMDOLVL1 \n" + " ,s.OMCURRAT \n" + " ,s.OMTAXAMT \n" + " ,s.OMFRTCST \n" + " ,s.OMGROSS \n" + " ,s.OMDISTOT \n" + " ,s.OMCURAT2 \n" + " ,s._Row SUBORD_Row \n" + " ,s._ORDSUB_OwnRow \n" + " ,s._Ts SUBORD_Ts\n" + " from Mfg_ORDMAST o\n" + " left join Mfg_SUBORD s on (s._ORDSUB_OwnRow = o._Row)\n" + " with check option\n" + "go\n" + "if exists (select * from sysobjects where id = object_id('dbo.RBP_CO') and sysstat & 0xf = 2)\n" + " drop view dbo.RBP_CO\n" + "GO\n\n" + "create view RBP_CO as\n" + "(\n" + "select Mfg_ORDMAST.OMTYPE ORDER_TYPE\n" + " ,Mfg_ORDMAST.OMON CO_NUMBER\n" + " ,Mfg_ORDMAST.OMVCWID CUST_ID\n" + " ,Mfg_ORDMAST.OMBPSID CSR\n" + " ,Mfg_SUBORD.OMORDST ORD_STATUS\n" + " ,Mfg_SUBORD.OMDATE CO_RV_DATE\n" + " ,Mfg_ORDMAST.OMSTID SHIP_TO_ID\n" + " ,Mfg_SHIPTO.STNAME SHIP_TO_NM\n" + " ,Mfg_SHIPTO.STAD1 SHIP_ADDR1\n" + " ,Mfg_SHIPTO.STAD2 SHIP_ADDR2\n" + " ,Mfg_SHIPTO.STCITY SHIP_CITY\n" + " ,Mfg_SHIPTO.STSTAT SHIP_STATE\n" + " ,Mfg_SHIPTO.STZIP SHIP_ZIP\n" + " ,Mfg_SHIPTO.STCNTR SHIP_CNTRY\n" + " ,Mfg_SHIPTO.STEXMPT TAX_EXEMPT\n" + " ,'C' CUST_POTYP\n" + " ,Mfg_ORDMAST.OMCUSREF CUST_PO_NO\n" + " ,Mfg_ORDMAST.OMVIA SHIP_VIA\n" + " ,Mfg_ORDMAST.OMFRTCD FRT_CHG_CD\n" + " ,Mfg_ORDMAST.OMFOB FOB_POINT\n" + " ,Mfg_ORDMAST.OMPAYCD IVC_COD\n" + " ,Mfg_ORDMAST.OMTRMPC1 DISC_PCNT1\n" + " ,Mfg_ORDMAST.OMTRMDA1 DISC_DAYS1\n" + " ,Mfg_ORDMAST.OMTRMPC2 DISC_PCNT2\n" + " ,Mfg_ORDMAST.OMTRMDA2 DISC_DAYS2\n" + " ,Mfg_ORDMAST.OMTRMNET NET_DAYS\n" + " ,Mfg_SUBORD.OMDOLVAL CO_AMOUNT\n" + " ,Mfg_ORDMAST.OMTRADE PRICE_FCTR\n" + " ,Mfg_ORDMAST.OMCOMCD COM_CODE\n" + " ,Mfg_ORDMAST.OMSCAT1 SALES_CAT1\n" + " ,Mfg_ORDMAST.OMSCAT2 SALES_CAT2\n" + " ,Mfg_ORDMAST.OMEXMPT EXEMPT\n" + " ,Mfg_ORDMAST.OMTXCERT CERT_NO\n" + " ,Mfg_ORDMAST.OMFTAXCD ORD_TAX_CODE_F\n" + " ,Mfg_ORDMAST.OMSTAXCD ORD_TAX_CODE_S\n" + " ,Mfg_ORDMAST.OMCTAXCD ORD_TAX_CODE_C\n" + " ,Mfg_ORDMAST.OMMTAXCD ORD_TAX_CODE_M\n" + " ,Mfg_SUBORD.OMCLSCNT CLS_LN_CT\n" + " ,Mfg_ORDMAST.OMHOLD CREDHOLD\n" + " ,Mfg_ORDMAST.OMDLVYDT SHIPDATE\n" + " ,Mfg_ORDMAST.OMEXPDT ORD_EXP_DATE\n" + " ,Mfg_ORDMAST.OMENDUSR END_USER\n" + " ,Mfg_ORDMAST.OMBILLTO BILLTO\n" + " ,Mfg_ORDMAST.OMPRIOR PRIORITY\n" + " ,Mfg_ORDMAST.OMSEXMPT S_EXEMPT\n" + " ,Mfg_ORDMAST.OMCEXMPT C_EXEMPT\n" + " ,Mfg_ORDMAST.OMMEXMPT M_EXEMPT\n" + " ,Mfg_ORDMAST.OMOEXMPT O_EXEMPT\n" + " ,Mfg_ORDMAST.OMOTAXCD O_TAX_CD\n" + " ,Mfg_ORDMAST.OMTMPLFG FLG_TMPT\n" + " ,Mfg_ORDMAST.OMTRMPC3 DISC_PCNT3\n" + " ,Mfg_ORDMAST.OMTRMDA3 DISC_DAYS3\n" + " ,Mfg_ORDMAST.OMTRMPC4 DISC_PCNT4\n" + " ,Mfg_ORDMAST.OMTRMDA4 DISC_DAYS4\n" + " ,Mfg_ORDMAST.OMSHPCUS SHPTO_CUST\n" + " ,Mfg_ORDMAST.OMREGION REGION\n" + " ,Mfg_ORDMAST.OMDSZONE DIST_ZONE\n" + " ,Mfg_ORDMAST.OMDSREG DISTREGION\n" + " ,Mfg_ORDMAST.OMSTXCER S_TAX_CERT\n" + " ,Mfg_ORDMAST.OMCTXCER C_TAX_CERT\n" + " ,Mfg_ORDMAST.OMMTXCER M_TAX_CERT\n" + " ,Mfg_ORDMAST.OMOTXCER O_TAX_CERT\n" + " ,Mfg_ORDMAST.OMMLTSHP MULT_SHP_O\n" + " ,Mfg_ORDMAST.OMPARITM PART_SHP_O\n" + " ,Mfg_ORDMAST.OMMLTITM MULT_LNSHP\n" + " ,Mfg_ORDMAST.OMDFTSTA DFLT_STAT\n" + " ,Mfg_ORDMAST.OMPRPOST RBP_POSTED\n" + " ,Mfg_SUBORD.OMTAXAMT TOT_TAXAMT\n" + " ,Mfg_SUBORD.OMFRTCST ORD_FRTCST\n" + " ,Mfg_SUBORD.OMGROSS GROSS_TOTL\n" + " ,Mfg_SUBORD.OMDISTOT DISC_TOTAL\n" + " ,Mfg_SUBORD.OMCURAT2 ALT_CURR\n" + " ,Mfg_DF.OPSEQN CO_LN_NO\n" + " ,Mfg_DF.ORDTYP LN_TYPE\n" + " ,Mfg_ITMMAST.IMPN ITEM\n" + " ,Mfg_ITMMAST.IMDESC ITEM_DESC\n" + " ,Mfg_ITMMAST.IMUM UM\n" + " ,Mfg_ITMMAST.IMREV REV\n" + " ,Mfg_ITMMAST.IMMKBY MB\n" + " ,Mfg_ITMMAST.IMTYPE ITEM_TYPE\n" + " ,Mfg_ITMMAST.IMSTAT ITEM_STAT\n" + " ,Mfg_ITMMAST.IMLOTTR LT\n" + " ,Mfg_ITMMAST.IMSERIAL SR\n" + " ,Mfg_ITMMAST.IMDRWG DRWG\n" + " ,Mfg_ITMMAST.IMCLAS1 ITEM_CLAS1\n" + " ,Mfg_ITMMAST.IMCLAS2 ITEM_CLAS2\n" + " ,Mfg_ITMMAST.IMCLAS3 ITEM_CLAS3\n" + " ,Mfg_ITMMAST.IMCLAS4 ITEM_CLAS4\n" + " ,Mfg_ITMMAST.IMCLAS5 ITEM_CLAS5\n" + " ,Mfg_ITMMAST.IMCLAS6 ITEM_CLAS6\n" + " ,Mfg_ITMMAST.IMCLAS7 ITEM_CLAS7\n" + " ,Mfg_ITMMAST.IMCLAS8 ITEM_CLAS8\n" + " ,Mfg_ITMMAST.IMNMF N_MOTR_FRT\n" + " ,Mfg_ITMMAST.IMNMFSC SUB\n" + " ,Mfg_ITMMAST.IMLTL ITEM_REF3\n" + " ,Mfg_ITMMAST.IMTL ITEM_REF4\n" + " ,Mfg_ITMMAST.IMREF ITEM_REF5\n" + " ,Mfg_ITMMAST.IMWEIGHT SHIP_WGHT\n" + " ,Mfg_ITMMAST.IMCUBEFT SHIP_VOL\n" + " ,Mfg_ITMMAST.IMPKGTYP PKG_TYPE\n" + " ,Mfg_ITMMAST.IMPCSPER PCS_PER\n" + " ,Mfg_ITMMAST.IMUPCCD UPC_CODE\n" + " ,Mfg_ITMMAST.IMREF1 ITEM_REF1\n" + " ,Mfg_ITMMAST.IMREF2 ITEM_REF2\n" + " ,Mfg_ITMMAST.IMGRPTCH GRP_TCH_CD\n" + " ,Mfg_ITMMAST.IMFAMILY FMLY_NAME\n" + " ,Mfg_ITMMAST.IMFGROUP FMLY_GROUP\n" + " ,Mfg_ITMMAST.IMCSTFAM COST_FMLY\n" + " ,Mfg_PRICES.PQPRIQUO STD_PRICE\n" + " ,Mfg_DF.QTYREQ ORDER_QTY\n" + " ,Mfg_SUBDF.DFPRICE UNIT_PRICE\n" + " ,Mfg_DF.REQDUEDT REQD_DATE\n" + " ,Mfg_DF.INSTRTDT RQST_SHIP\n" + " ,Mfg_SUBDF.DFEXPDAT EXP_DATE\n" + " ,Mfg_SUBDF.DFORGSHP ORIG_DATE\n" + " ,Mfg_SUBDF.DFUM CI_UM\n" + " ,Mfg_SUBDF.DFCUSQTY CUST_QTY\n" + " ,Mfg_SUBDF.DFCUSPRC CUST_PRICE\n" + " ,Mfg_SUBDF.DFALTUM ALT_UM\n" + " ,Mfg_SUBDF.DFALTQTY ALT_QTY\n" + " ,Mfg_SUBDF.DFALTPRC ALT_PRICE\n" + " ,Mfg_SUBDF.DFGROPRC GROSS_PRC\n" + " ,Mfg_DF.ORDSTA LN_STA\n" + " ,Mfg_DF.DFDMTYP DMND_TYP\n" + " ,Mfg_DF.QTYISS ISSUED_QTY\n" + " ,Mfg_DF.OUTNEDDT DT_LST_SHP\n" + " ,Mfg_SUBDF.DFTRANLT TR_LT\n" + " ,Mfg_SUBDF.DFSRCFLG SRC_TYPE\n" + " ,Mfg_SUBDF.DFFTCFLG TAX_CODE_F\n" + " ,Mfg_SUBDF.DFSTCFLG TAX_CODE_S\n" + " ,Mfg_SUBDF.DFCTCFLG TAX_CODE_C\n" + " ,Mfg_SUBDF.DFMTCFLG TAX_CODE_M\n" + " ,Mfg_SUBDF.DFOTCFLG TAX_CODE_O\n" + " ,Mfg_SUBDF.DFCOMCD SUBDF_COM_CODE\n" + " ,Mfg_SUBDF.DFCCFLG OVR\n" + " ,Mfg_SUBDF.DFTRADE PRICE_ADJ\n" + " ,Mfg_SUBDF.DFPSRCE PRICE_SRCE\n" + " ,Mfg_SUBDF.DFGROQTY GROSS_QTY\n" + " ,Mfg_SUBDF.DFUMCNVT CI_UM_CNVT\n" + " ,Mfg_SUBDF.DFALTCVT UM_CVRT\n" + " ,Mfg_SUBDF.DFPARITM PART_SHP_L\n" + " ,Mfg_SUBDF.DFMLTITM MULT_SHP_L\n" + " ,Mfg_SUBDF.DFAUTHNO AUTH_NUM\n" + " ,Mfg_DF.POUID PT_USE\n" + " ,Mfg_SUBDF.DFSHQTY TOT_SHPPED\n" + " ,Mfg_DF.DFCUSLIN CUS_PO_LN\n" + " ,Mfg_CUSTMAST.CMCUNAME CUST_NAME\n" + " ,Mfg_CUSTMAST.CMCONTCT CUST_CNTCT\n" + " ,Mfg_CUSTMAST.CMPHONE CUST_PHONE\n" + " ,Mfg_CUSTMAST.CMCUAD1 CUST_ADDR1\n" + " ,Mfg_CUSTMAST.CMCUAD2 CUST_ADDR2\n" + " ,Mfg_CUSTMAST.CMCUCITY CUST_CITY\n" + " ,Mfg_CUSTMAST.CMCUSTAT CUST_STATE\n" + " ,Mfg_CUSTMAST.CMCUCNTR CUST_CNTRY\n" + " ,Mfg_CUSTMAST.CMCUZIP CUST_ZIP\n" + " ,Mfg_CUSTMAST.CMFAX FAX_NUMBER\n" + " ,Mfg_CUSTMAST.CMCSR CUST_CSR\n" + " ,Mfg_CUSTMAST.CMACTCNT ACCT_CNTCT\n" + " ,Mfg_CUSTMAST.CMACFONE ACCT_PHONE\n" + " ,Mfg_CUSTMAST.CMDBID DB_REF_NO\n" + " ,Mfg_CUSTMAST.CMDBSIC DB_CLASS\n" + " ,Mfg_CUSTMAST.CMDBRATE DB_RATG\n" + " ,Mfg_CUSTMAST.CMDBDATE DB_DATE\n" + " ,Mfg_CUSTMAST.CMINTRST RATE\n" + " ,Mfg_CUSTMAST.CMBANK1 BANK1_REF\n" + " ,Mfg_CUSTMAST.CMBANK2 BANK2_REF\n" + " ,Mfg_CUSTMAST.CMCREDIT CR_LIMIT\n" + " ,Mfg_CUSTMAST.CMCRAUTH CREDIT_BY\n" + " ,Mfg_CUSTMAST.CMCRDATE CR_DATE\n" + " ,Mfg_CUSTMAST.CMARTYPE OPNBAL_FWD\n" + " ,Mfg_CUSTMAST.CMSTMTCD STMT_PRINT\n" + " ,Mfg_CUSTMAST.CMSTMTCY STMT_CYCLE\n" + " ,Mfg_CUSTMAST.CMAR AR_CUST\n" + "-- ,Mfg_CUSTMAST.CMFOB CUST_FOB_POINT\n" + " ,Mfg_CUSTMAST.CMPARTL PARTL_SHIP\n" + " ,Mfg_CUSTMAST.CMFTACNO FRGHT_ACCT\n" + " ,Mfg_CUSTMAST.CMPRNT PRT\n" + " ,Mfg_SHIPTO.STREGION REGN_CODE\n" + " ,Mfg_CUSTMAST.CMCLASS CUST_CLAS1\n" + " ,Mfg_CUSTMAST.CMCLASS$2 CUST_CLAS2\n" + " ,Mfg_CUSTMAST.CMCLASS$3 CUST_CLAS3\n" + " ,Mfg_CUSTMAST.CMCLASS$4 CUST_CLAS4\n" + " ,Mfg_CUSTMAST.CMCLASS$5 CUST_CLAS5\n" + " ,Mfg_CUSTMAST.CMCLASS$6 CUST_CLAS6\n" + " ,Mfg_CUSTMAST.CMCLASL CUST_CLAS7\n" + " ,Mfg_CUSTMAST.CMCLASL$2 CUST_CLAS8\n" + " ,Mfg_CUSTMAST.CMSACNO SAL_ACCTNO\n" + " ,Mfg_CUSTMAST.CMCGACNO COGS_AC_NO\n" + " ,Mfg_CUSTMAST.CMARACNO ACCOUNT_NO\n" + " ,Mfg_SUBCUST.CMYTDPO YTD_SHPMTS\n" + " ,Mfg_SUBCUST.CMYTDPD YTD_PAYMTS\n" + " ,Mfg_SUBCUST.CMYTDSLS YTD_SALES\n" + " ,Mfg_SUBCUST.CMYTDSVC YTD_SVCHG\n" + " ,Mfg_SUBCUST.CMARBAL BAL_DUE\n" + " ,Mfg_SUBCUST.CMUNAPCR UNAP_CRED\n" + " ,Mfg_SUBCUST.CMUNAPCS UNAP_CASH\n" + " ,Mfg_SUBCUST.CMBOOK BOOKED\n" + " ,Mfg_SUBCUST.CMARCUR CURR_BAL\n" + " ,Mfg_SUBCUST.CMAR30 AGE_CAT_1\n" + " ,Mfg_SUBCUST.CMAR60 AGE_CAT_2\n" + " ,Mfg_SUBCUST.CMAR90 AGE_CAT_3\n" + " ,Mfg_SUBCUST.CMARHOLD HOLD_AMT\n" + " ,Mfg_SUBCUST.CMLSTINV LST_IVCDAT\n" + " ,Mfg_SUBCUST.CMLSTPMT LST_PAYDAT\n" + " ,Mfg_SUBCUST.CMSVCHRG SVC_CHRG\n" + " ,Mfg_CUSTMAST.CMCARR CARRIER\n" + " ,Mfg_CUSTMAST.CMTRCLAS TRADECLASS\n" + " ,Mfg_CUSTMAST.CMTOPLVL TOPLVLCUST\n" + " ,Mfg_CUSTMAST.CMCLVL CUSTLVL\n" + " ,Mfg_CUSTMAST.CMENDUSR ENDUSERCID\n" + " ,Mfg_CUSTMAST.CMBILLTO BILLTOCID\n" + " ,Mfg_CUSTMAST.CMACASGN CREDITASGN\n" + " ,Mfg_CUSTMAST.CMACREMV CREDITREMV\n" + " ,Mfg_CUSTMAST.CMSHCODE SHIP_RGN\n" + " ,Mfg_CUSTMAST.CMRTCODE ROUTE_RGN\n" + " ,Mfg_CUSTMAST.CMPALLOC PART_ALLOC\n" + " ,Mfg_CUSTMAST.CMBKCUST BANK_CID\n" + " ,Mfg_CUSTMAST.CMCRREP CREDIT_REP\n" + " ,Mfg_CUSTMAST.CMREGION REGIONCODE\n" + " ,Mfg_CUSTMAST.CMFTAXCD TAX_CODE1\n" + " ,Mfg_CUSTMAST.CMSTAXCD TAX_CODE2\n" + " ,Mfg_CUSTMAST.CMCTAXCD TAX_CODE3\n" + " ,Mfg_CUSTMAST.CMMTAXCD TAX_CODE4\n" + " ,Mfg_CUSTMAST.CMEXMPT TAX1EXMPT\n" + " ,Mfg_CUSTMAST.CMEXS TAX2EXPMT\n" + " ,Mfg_CUSTMAST.CMEXC TAX3EXPMT\n" + " ,Mfg_CUSTMAST.CMEXM TAX4EXPMT\n" + " ,Mfg_CUSTMAST.CMTXCERT TAX1CERT\n" + " ,Mfg_CUSTMAST.CMSTXCER TAX2CERT\n" + " ,Mfg_CUSTMAST.CMCTXCER TAX3CERT\n" + " ,Mfg_CUSTMAST.CMMTXCER TAX4CERT\n" + " ,Mfg_CUSTMAST.CMVATCUS VATCUSTCD\n" + " ,Mfg_CUSTMAST.CMPRTFMT SHIPTOFMT\n" + " ,Mfg_CUSTMAST.CMPRTLNG SHIPTOLNG\n" + " ,Mfg_CUSTMAST.CMSTKRM SHIPTOSTK\n" + " ,Mfg_CUSTMAST.CMBIN SHIPTOBIN\n" + " ,Mfg_SUBCUST.CMARFUT TOTARDUE_L\n" + " ,Mfg_SUBCUST.CMFARFUT TOTARDUE_F\n" + " ,Mfg_SUBCUST.CMPENDST PEND_CASH\n" + " ,Mfg_SUBCUST.CMLPENDP AR_PEND_L\n" + " ,Mfg_SUBCUST.CMFPENDP AR_PEND_F\n" + " ,Mfg_SUBCUST.CMLPENDI MTCHPEND_L\n" + " ,Mfg_SUBCUST.CMFPENDI MTCHPEND_F\n" + " ,Mfg_PRODLINE.PLPRDLN PLPRDLN\n" + " ,'C' + Mfg_ORDMAST.OMON ORDKEY\n\n" + "from Mfg_ORDMAST\n" + " join Mfg_SUBORD on (Mfg_SUBORD._ORDSUB_OwnRow = Mfg_ORDMAST._Row)\n" + " left outer join Mfg_SHIPTO on (Mfg_SHIPTO._Row = Mfg_ORDMAST._ORDSADD_OwnRow)\n" + " left outer join Mfg_DFSFNSF as Mfg_DF on (Mfg_DF._ORDD_OwnRow = Mfg_ORDMAST._Row)\n" + " left outer join Mfg_ITMMAST on (Mfg_ITMMAST._Row = Mfg_DF._ITMD_OwnRow)\n" + " left outer join Mfg_PRICES on ((Mfg_PRICES._PRICQUOT_OwnRow = Mfg_ITMMAST._Row) and (Mfg_PRICES._PRICQUOT_OwnRec = 19))\n" + " join Mfg_SUBDF on (Mfg_SUBDF._DFSUB_OwnRow = Mfg_DF._Row)\n" + " join Mfg_CUSTMAST on ((Mfg_CUSTMAST._Row = Mfg_ORDMAST._VCORD_OwnRow) and (Mfg_ORDMAST._VCORD_OwnRec = 11))\n" + " join Mfg_SUBCUST on (Mfg_SUBCUST._CUSTSUB_OwnRow = Mfg_CUSTMAST._Row)\n" + " left outer join Mfg_PRODLINE on (Mfg_PRODLINE._Row = Mfg_ITMMAST._PRODIT_OwnRow)\n" + ")\n" + "with check option\n" + "GO\n\n\n" + "--------------------------------------------------------------------------------\n" + "-- NAME: SUPPLY\n" + "--\n" + "-- PURPOSE: Represents the one to one relationship between Mfg_DFSFNSF and\n" + "-- Mfg_SUBSF. This includes only inventoried supplies (RECTYPE = S).\n" + "--------------------------------------------------------------------------------\n\n" + "if objectproperty(object_id('SUPPLY'), 'IsView') = 1 \n" + " drop view SUPPLY\n" + "go\n\n" + "create view SUPPLY as\n" + " select s.RECTYPE \n" + " ,s.QTYREQ \n" + " ,s.ORDTYP \n" + " ,s.ORDSTA \n" + " ,s.OPSEQN \n" + " ,s.POUID \n" + " ,s.QTYTYP \n" + " ,s.CMPLNTYP \n" + " ,s.INSTRTDT \n" + " ,s.OUTNEDDT \n" + " ,s.REQDUEDT \n" + " ,s.SORTKEY \n" + " ,s.USERFD \n" + " ,s.QTYRCV \n" + " ,s.QTYATP \n" + " ,s.REV \n" + " ,s.LINENUM \n" + " ,s.TAXCD \n" + " ,s.ORGPRM \n" + " ,s.SORTKEY2 \n" + " ,s.LSTRCV \n" + " ,s.SFREFTY \n" + " ,s.SFREF \n" + " ,s.DELOPN \n" + " ,s.DELCNT \n" + " ,s.MRPORDST \n" + " ,s.TOPLEVEL \n" + " ,s.CURLEVEL \n" + " ,s.LEVELKEY \n" + " ,s._Row DFSFNSF_Row\n" + " ,s._ITMATP_OwnRow \n" + " ,s._ITMATP_OwnRec \n" + " ,s._ITMOS_OwnRow \n" + " ,s._ITMOS_OwnRec \n" + " ,s._ITMS_OwnRow \n" + " ,s._ITMS_OwnRec \n" + " ,s._ORDS_OwnRow \n" + " ,s._SD_OwnRow \n" + " ,s._Ts DFSFNSF_Ts \n" + " ,ss.SFIIQTY \n" + " ,ss.SFHOQTY \n" + " ,ss.SFCOST \n" + " ,ss.SFUM \n" + " ,ss.SFUMCNVT \n" + " ,ss.SFDOLRCV \n" + " ,ss.SFCUMLAB \n" + " ,ss.SFVAROH \n" + " ,ss.SFCUMMAT \n" + " ,ss.SFCUMOUT \n" + " ,ss.SFSCRQTY \n" + " ,ss.SFCLODAT \n" + " ,ss.SFFIXOH \n" + " ,ss.SFCLASS0 \n" + " ,ss.SFCLASS1 \n" + " ,ss.SFCLASS2 \n" + " ,ss.SFCLASS3 \n" + " ,ss.SFCLASS4 \n" + " ,ss.SFCLASS5 \n" + " ,ss.SFCLASL0 \n" + " ,ss.SFCLASL1 \n" + " ,ss.SFEXRATE \n" + " ,ss.SFEXRAT9 \n" + " ,ss.SFEXOP \n" + " ,ss.SFEXOP9 \n" + " ,ss._Row SUBSF_Row \n" + " ,ss._SFSUB_OwnRow \n" + " ,ss._Ts SUBSF_Ts\n" + " from Mfg_DFSFNSF s\n" + " left join Mfg_SUBSF ss on (ss._SFSUB_OwnRow = s._Row)\n" + " where s.RECTYPE = 'S'\n" + " with check option\n" + "go \n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RPT_EngineeringBillOfMaterialParent]') and objectproperty(id, N'IsView') = 1)\n" + " drop view dbo.RPT_EngineeringBillOfMaterialParent\n" + "go\n" + "------------------------------------------------------------------------------------------\n" + "-- NAME: RPT_EngineeringBillOfMaterialParent\n" + "-- COPYRIGHT: Copyright ?2002, SoftBrands Manufacturing, Inc. All rights reserved.\n" + "--\n" + "-- FUNCTION: The parent item information in the engineering temporary tables.\n" + "------------------------------------------------------------------------------------------\n" + "create view RPT_EngineeringBillOfMaterialParent as\n\n" + " select p.SOURCE ItemSource\n" + " ,p.ITEM ItemNumber\n" + " ,p.EFF_DATE EffectivityDate\n" + " ,p.EFF_REV EffectiveRevision\n" + " ,p.ITEM_DESC ItemDescription\n" + " ,p.REV ItemRevision\n" + " ,p.UM ItemUM\n" + " ,p.MB MakeBuyCode\n" + " ,p.RUN_LT RunLeadTimeDays\n" + " ,p.FIX_LT FixedLeadTimeDays\n" + " ,p.INSP_LT InspectionLeadTimeDays\n" + " ,p.PLNR Planner\n" + " ,p.LT IsLotTraced\n" + " ,p.PLN_POLICY PlanningPolicy\n" + " ,p.DRWG DrawingNumber\n" + " ,p.SOURCE2 ItemSource2\n" + " ,p.ITEM2 ItemNumber2\n" + " ,p.EFF_DATE2 EffectivityDate2\n" + " ,p.EFF_REV2 EffectiveRevision2\n" + " ,p.ITEM_DESC2 ItemDescription2\n" + " ,p.REV2 ItemRevision2\n" + " ,p.UM2 ItemUM2\n" + " ,p.MB2 MakeBuyCode2\n" + " ,p.RUN_LT2 RunLeadTimeDays2\n" + " ,p.FIX_LT2 FixedLeadTimeDays2\n" + " ,p.INSP_LT2 InspectionLeadTimeDays2\n" + " ,p.PLNR2 Planner2\n" + " ,p.LT2 IsLotTraced2\n" + " ,p.PLN_POLICY2 PlanningPolicy2\n" + " ,p.DRWG2 DrawingNumber2\n" + " ,p.EXCLUSION_STRING ExclusionString\n" + " ,p.DISPLAY_STRING DisplayString\n" + " ,p.STANDARD_VIEWNUMBER StandardViewNumber\n" + " ,p.BUY_COSTDEF BuyCostDefinition\n" + " ,p.MAKE_COSTDEF MakeCostDefinition\n" + " ,p.AVAIL_QTYDEF AvailQuantityDefinition\n" + " ,p.LOCATION_INCL_CODE LocationIncludeCode\n" + " ,p.STOCK_BIN_DEF StockBinDefinition\n" + " ,p.PROD_QTY ProductionQuantity\n" + " ,p.SUMB_REPORT_NUMBER SUMBReportNumber\n" + " ,p.CUM_LT CumulativeLeadTimeDays\n" + " ,p.MEXP_SELECTED_LT_VALUE MEXPSelectedLeadTimeDays\n" + " ,p.COST_TYPE CostType\n" + " ,p.COST_CODE CostCode\n" + " ,p.YIELD YieldPercentage\n" + " ,p.RAW_MATL RawMaterialCost\n" + " ,p.RAW_LABOR RawLaborCost\n" + " ,p.RAW_VOH RawVariableOverheadCost\n" + " ,p.RAW_FOH RawFixedOverheadCost\n" + " ,p.ATL_MATL MaterialCostAtThisLevel\n" + " ,p.ATL_LABOR LaborCostAtThisLevel\n" + " ,p.ATL_FOH FixedOverheadCostAtThisLevel\n" + " ,p.ATL_VOH VariableOverheadCostAtThisLevel\n" + " ,p.ATL_TOTAL TotalCostAtThisLevel\n" + " ,p.ROLLED_MATL RolledMaterialCost\n" + " ,p.ROLLED_LABOR RolledLaborCost\n" + " ,p.ROLLED_VOH RolledVariableOverheadCost\n" + " ,p.ROLLED_FOH RolledFixedOverheadCost\n" + " ,p.ROLLED_TOTAL RolledTotalCost\n" + " ,p.ROLLED_MATL_OR RolledMaterialCostOrderRelated\n" + " ,p.ROLLED_LABOR_OR RolledLaborCostOrderRelated\n" + " ,p.ROLLED_VOH_OR RolledVariableOverheadCostOrderRelated\n" + " ,p.ROLLED_FOH_OR RolledFixedOverheadCostOrderRelated\n" + " ,p.ROLLED_TOTAL_OR RolledTotalCostOrderRelated\n" + " ,p.RESMATL_FLAG ResourceMaterialFlag\n" + " ,p.LOTSIZE LotSizeQuantity\n" + " ,p.COMPANYNAME CompanyName\n" + " ,p.USERID UserID\n" + " ,p.COMPAREHIDE CompareHide\n" + " ,p.REQD_EXT_COST RequiredExtendedCost\n" + " ,p.CONS_EXT_COST ConsumedExtendedCost\n" + " ,p.TOTL_EXT_COST TotalExtendedCost\n" + " ,p.REQD_AVG_COST RequiredAverageCost\n" + " ,p.CONS_AVG_COST ConsumedAverageCost\n" + " ,p.TOTL_AVG_COST TotalAverageCost\n" + " ,p.TOTL_ORDER_RELATED TotalOrderRelated\n" + " ,p.MEXP_LABOR MEXPLaborCost\n" + " ,p.MEXP_MATL MEXPMaterialCost\n" + " ,p.MEXP_VOVHD MEXPVariableOverheadCost\n" + " ,p.MEXP_FOVHD MEXPFixedOverheadCost\n" + " ,p.MEXP_TOTCOST MEXPTotalCost\n" + " ,p.STD_MATL StandardMaterialCost\n" + " ,p.STD_LABOR StandardLaborCost\n" + " ,p.STD_VOH StandardVariableOverheadCost\n" + " ,p.STD_FOH StandardFixedOverheadCost\n" + " ,p.STD_TOTAL StandardTotalCost\n" + " ,p.ReportID ReportID\n" + " from <FSDBXXTemp, char, >.[dbo].BMPARENT p\n\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RPT_EngineeringBillOfMaterialComparison]') and objectproperty(id, N'IsView') = 1)\n" + " drop view dbo.RPT_EngineeringBillOfMaterialComparison\n" + "go\n" + "------------------------------------------------------------------------------------------\n" + "-- NAME: RPT_EngineeringBillOfMaterialComparison\n" + "-- COPYRIGHT: Copyright ?2002, SoftBrands Manufacturing, Inc. All rights reserved.\n" + "--\n" + "-- FUNCTION: The BOM comparision information stored in the engineering temporary tables.\n" + "------------------------------------------------------------------------------------------\n" + "create view RPT_EngineeringBillOfMaterialComparison as\n\n" + " select c.MATCHED IsMatched\n" + " ,c.PARENT1 ParentItemNumber1\n" + " ,c.PT_USE1 PointOfUseID1\n" + " ,c.SEQN1 OperationSequenceNumber1\n" + " ,c.COMPONENT1 ComponentItemNumber1\n" + " ,c.COMPONENT_ITEMSOURCE1 ComponentItemSource1\n" + " ,c.COMP_DESC1 ComponentItemDescription1\n" + " ,c.COM_TYP1 ComponentType1\n" + " ,c.QUANTITY1 RequiredQuantity1\n" + " ,c.QTY_TYP1 QuantityType1\n" + " ,c.IN_EFFECT1 InEffectivityDate1\n" + " ,c.OUT_EFFECT1 OutEffectivityDate1\n" + " ,c.IN_REV1 InRevision1\n" + " ,c.OUT_REV1 OutRevision1\n" + " ,c.REFDES1 ReferenceDesignator1\n" + " ,c.RD_COUNT1 ReferenceDesignatorCount1\n" + " ,c.PROD_ITEM1 ProductItemNumber1\n" + " ,c.PARENT2 ParentItemNumber2\n" + " ,c.PT_USE2 PointOfUseID2\n" + " ,c.SEQN2 OperationSequenceNumber2\n" + " ,c.COMPONENT2 ComponentItemNumber2\n" + " ,c.COMPONENT_ITEMSOURCE2 ComponentItemSource2\n" + " ,c.COMP_DESC2 ComponentItemDescription2\n" + " ,c.COM_TYP2 ComponentType2\n" + " ,c.QUANTITY2 RequiredQuantity2\n" + " ,c.QTY_TYP2 QuantityType2\n" + " ,c.IN_EFFECT2 InEffectivityDate2\n" + " ,c.OUT_EFFECT2 OutEffectivityDate2\n" + " ,c.IN_REV2 InRevision2\n" + " ,c.OUT_REV2 OutRevision2\n" + " ,c.REFDES2 ReferenceDesignator2\n" + " ,c.RD_COUNT2 ReferenceDesignatorCount2\n" + " ,c.PROD_ITEM2 ProductItemNumber2\n" + " ,c.ReportID ReportID\n" + " from <FSDBXXTemp, char, >.[dbo].BMCOMPARE c\n\n" + "go\n\n" + "if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[RPT_EngineeringMultiLevelBillOfMaterial]') and objectproperty(id, N'IsView') = 1)\n" + " drop view dbo.RPT_EngineeringMultiLevelBillOfMaterial\n" + "go\n" + "------------------------------------------------------------------------------------------\n" + "-- NAME: RPT_EngineeringMultiLevelBillOfMaterial\n" + "-- COPYRIGHT: Copyright ?2002, SoftBrands Manufacturing, Inc. All rights reserved.\n" + "--\n" + "-- FUNCTION: The Multi Level Bill information stored in the engineering temporary tables.\n" + "------------------------------------------------------------------------------------------\n" + "create view RPT_EngineeringMultiLevelBillOfMaterial as\n\n" + " select m.PROCESSING_ORDER ProcessingOrder\n" + " ,m.HASLOWERLEVELS HasLowerLevels\n" + " ,m.INTERNAL_COMPONENT InternalComponentItemNumber\n" + " ,m.ML_LEVEL MultiLevelNumber\n" + " ,m.DISPLAY_LEVEL DisplayLevel\n" + " ,m.ML_KEY_RECORD ComponentItemKey\n" + " ,m.INTERNALKEY InternalComponentItemKey\n" + " ,m.COMPONENT_ITEMSOURCE ComponentItemSource\n" + " ,m.PARENT_ITEMSOURCE ParentItemSource\n" + " ,m.PARENT_BOMSOURCE ParentBOMSource\n" + " ,m.EXCLUDE_FLAG ExcludeFlag\n" + " ,m.ML_COMPONENT ComponentItemNumber\n" + " ,m.ML_PROD_COMPONENT ProductionComponentItemNumber\n" + " ,m.ML_PARENT ParentItemNumber\n" + " ,m.ML_PT_USE PointOfUseID\n" + " ,m.ML_SEQN OperationSequenceNumber\n" + " ,m.ML_COM_TYP ComponentType\n" + " ,m.ML_LT_OFFSET LeadTimeOffsetDays\n" + " ,m.ML_QUANTITY RequiredQuantity\n" + " ,m.ML_QTY_TYP QuantityType\n" + " ,m.ML_IN_EFFECT InEffectivityDate\n" + " ,m.ML_OUT_EFFECT OutEffectivityDate\n" + " ,m.ML_IN_REV InRevision\n" + " ,m.ML_OUT_REV OutRevision\n" + " ,m.ML_SCRAP_PCNT ScrapPercent\n" + " ,m.ML_MSCFGGRP ConfigurationGroup\n" + " ,m.ML_MSCFGQTY ConfigurationQuantity\n" + " ,m.ML_MSCFGTYP ConfigurationType\n" + " ,m.ML_MSMODIND IsModuleOrNormal\n" + " ,m.ML_MSTXTID TextID\n" + " ,m.ML_MSSTKRM BackflushStockroom\n" + " ,m.ML_MSBIN BackflushBin\n" + " ,m.ML_MSCOMPMB IsScrapBackflushed\n" + " ,m.ML_MSCOMPUM ComponentItemUM\n" + " ,m.ML_COMPONENT_TEXT ComponentText\n" + " ,m.ML_MAKEBUY MakeBuyCode\n" + " ,m.ML_DESCRIPTION ComponentItemDescription\n" + " ,m.ML_LEADTIME TotalLeadTimeDays\n" + " ,m.ML_SUMMARYQTY SummaryQuantity\n" + " ,m.ML_COSTINGQTY CostingQuantity\n" + " ,m.ML_REQUIREDQTY ComponentRequiredQuantity\n" + " ,m.ML_CONSUMEDQTY ConsumeQuantity\n" + " ,m.ML_AVAILINV_ONHAND AvailableOnHandQuantity\n" + " "; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE); final Matcher matcher = pattern.matcher(string); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(i)); } } } }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html