Syntax of goto keyword

Hi all,
Can any body tell me syntax of goto keyword. With an example.

JoachimSauer wrote:
tsith wrote:
Well, you can do the same sort of "jumping around" with labeled break and continue, yes.Although you can only do it in a more limited way (compared with goto as it is present in other languages). And thank Gosling for that!I would have thanked him more if he had not even made 'goto' a reserved word. I can't see why he made it a reserved word unless somewhere in his subconscious he thought that he might have to include a real 'goto' in the language.

Similar Messages

  • JDBC Receiver Adapter:Incorrect syntax near the keyword 'FROM'

    Hi All,
    I'm trying to get data from an SQL 2005 server using synchronous JDBC receiver adapter. I'm using PI 7.0. My outgoing message is as follows:
      <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_IZIN_YUKU_REQ xmlns:ns0="http://holding.com/brd/">
    - <STATEMENT>
    - <ECZ_IZIN_YUKU action="SELECT">
      <table>ECZ_IZIN_YUKU</table>
      <access />
    - <key>
      <iy_yil compareOperation="GT">1900</iy_yil>
      </key>
      </ECZ_IZIN_YUKU>
      </STATEMENT>
      </ns0:MT_IZIN_YUKU_REQ>
    I've found the following log in the trace file:
    #1.5#0014C23BCFC900630000003D000013B000042740B0A858B1#1169058702046#/Applications/ExchangeInfrastructure/AdapterFramework/Services/ADAPTER/ADMIN/JDBC#sap.com/com.sap.aii.af.app#com.sap.aii.adapter.jdbc.XI2JDBC.onInternalMessageBinary(Message)#J2EE_GUEST#0####fa10f5f0a65811db84410014c23bcfc9#XI XI2JDBC[CC_JDBC_RECI_BRD_TO_BHT/HUMANIST/]_2574##0#0#Error#1#com.sap.aii.adapter.jdbc.XI2JDBC#Plain###Error processing request, rollback: Error processing request in sax parser: Error when executing statement for table/stored proc. 'ECZ_IZIN_YUKU' (structure 'STATEMENT'): com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'FROM'.#
    Thanks a lot..

    Hi,
    Make sure the XML structure for your SQL statement is correct. Include the all the fields in the structure of XML.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_IZIN_YUKU_REQ xmlns:ns0="http://holding.com/brd/">
    <STATEMENT>
              <TECZ_IZIN_YUKU ACTION="SELECT">
                     <TABLE>ECZ_IZIN_YUKU</TABLE>
                              <ACCESS>
                                   <EMPNO></EMPNO>
                                   <NAME></NAME>
                               </ACCESS>
                                 <KEY>
                                       <iy_yil compareOperation="GT">1900</iy_yil>
                                 </KEY>
    </TABLENAME>
    </STATEMENT>
    </ns0:MT_IZIN_YUKU_REQ>
    Best Regards

  • Incorrect syntax near the keyword 'AND'.

    Hi Friends,
    I have a requirement from SAP BI to SQL database.
    When I am triggering data from SAP BI, it is successfully sent to XI.
    In XI, it is also in success.
    But when I check in Message monitoring, I faced a error.
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'ZSaleFromBI' (structure 'Data'): com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'AND'.
    The data is not updating in SQL Database also.
    Kindly suggest the same.
    Regards,
    Narendra Goyal

    Hi,
    After debugging lot, I found a payload difference.
    In PI 7.0 Inbound message from BI is:
      <?xml version="1.0" encoding="utf-8" ?>
    - <n0:MT_OTBData_BI xmlns:n0="http://grmap.com/xi/grmap/OTB_Data_OB" xmlns:prx="urn:sap.com:proxy:BIJ:/1SAI/TAS05A432A314B70F5CEB43:700:2008/01/11">
    + <DataRow>
    + <DataRow>
    + <DataRow>
      </n0:MT_OTBData_BI>
    In XI 3.0 Inbound message from BI is:
      <?xml version="1.0" encoding="utf-8" ?>
    - <nr1:MT_OTBData_BI xmlns:nr1="http://grmap.com/xi/grmap/OTB_Data_OB">
    + <DataRow>
    + <DataRow>
    + <DataRow>
      </nr1:MT_OTBData_BI>
    Kindly provide suggestion to resolve this issue.
    Regards,
    Narendra Goyal

  • Syntax error on keyword "void"; "interface", "class" expected

    When migrating my application for Visual-Age to Web-Sphere 5.1
    The following error occurred:
    Syntax error on keyword "void"; "interface", "class" expected
    for the code:
    * ejbLoad method comment
    * @exception javax.ejb.EJBException The exception description.
    public void ejbLoad() throws javax.ejb.EJBException{
         _initLinks();
    }Thanking you in an advance

    I had missed a closing breacket '}'

  • Incorrect syntax near the keyword 'Values'

    Hi all I was wondering if you could help I keep getting this error when I try to build this stored procedure in sql 2008
    CREATE PROCEDURE dbo.TutorialAddHeadline
    @title varchar(100), @content varchar(MAX), @publisher varchar(50), @linkurl varchar(255)
    AS
    BEGIN
    DECLARE @hash binary(16);
    SET @hash = dbo.TutorialHash(@title, @content);
    VALUES(@publisher, @title, @content, @linkurl, @hash);
    END
    thanks

    Try:
    INSERT YOURTABLE (YOUR_COLUMN_LIST)
    VALUES....
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Order is getting Syntax Error ????

    I am receiving and error message regarding syntax of the ORDER command. I have attached the code, error message and DDLs for the tables.
    select COALESCE(a.[Material],b.[Part_Number],c.[Part_Number])                 AS [Material],
    COALESCE(a.[Description],b.[Description],c.[Description])                     AS [Description],
    COALESCE(a.[LD],b.[LD],c.[LD])                                                AS [LD],
    COALESCE(a.[SalesOrder],b.[SalesOrder],c.[SalesOrder])                        As [SalesOrder],
    COALESCE(a.[Ln],b.[Ln],c.[Ln])                                                As [Ln],
    COALESCE(a.[S/J],b.[S/J],c.[S/J])                                             As [Type],
    COALESCE(a.[Job],b.[Job],c.[Job])                                             AS [Job], 
    COALESCE(a.[SalesCode],b.[SalesCode],c.[SalesCode])                           As [SalesCode],
    COALESCE(a.[OpenQty],0) + COALESCE(b.[OpenQty],0) + COALESCE(c.[OpenQty],0)   As [OpenQty],
    COALESCE(a.[OrderDate],b.[OrderDate],c.[OrderDate])                           As [OrderDate],
    (Case when b.[PromDate] = '1900-01-01' then '' else a.[PromDate] end)         As [PromDate],
    SUBSTRING(ISNULL(c.[WorkCenter],''),4,11)                                     AS [WorkCenter]
    from
    Select a.Material                                                             As [Material]
           ,Ma.Description                                                        As [Description]
           ,Ma.Lead_Days                                                          As [LD]
           ,a.Sales_Order                                                         As [SalesOrder]
           ,a.SO_Line                                                             As [Ln]
           ,'S'                                                                  
    As [S/J]
           ,a.Job                                                                
    As [Job]
           ,a.Sales_Code                                                          AS [SalesCode]
           ,Sum(a.Order_Qty - a.Picked_Qty - a.Shipped_Qty)                       AS [OpenQty]
           ,Cast(SH.Order_Date As Date)                                           AS [OrderDate]
           ,Cast(a.Promised_Date As Date)                                         AS [PromDate]
     As [WorkCenter]
           from [PRODUCTION].dbo.SO_Detail as a
    inner join [PRODUCTION].dbo.Material As Ma
          on a.Material = Ma.Material 
    inner join [PRODUCTION].dbo.SO_Header As SH
          on a.Sales_Order = SH.Sales_Order
    Where (a.Status = 'Open' or a.Status = 'Backorder') 
    and a.Job <> ''
    and (a.Order_Qty - a.Picked_Qty - a.Shipped_Qty > 0)
    GROUP BY a.Material, a.Job, [S-J], Ma.Sales_Code, Ma.Lead_Days, SH.Order_Date, a.Promised_Date, Ma.Description, a.Sales_Order, a.SO_Line/JBSettings, -J
    )a
    full join
    Select b.Part_Number                                                          As [Part_Number]
           ,ISNULL(b.Description,'')                                              As [Description]
           ,Mb.Lead_Days                                                          As [LD]
           ,'00000'                                                               As [SalesOrder]
     As [Ln]
           ,'J'                                                                  
    As [S/J]
           ,b.Job                                                                
    As [Job]
           ,Mb.Sales_Code                                                         As [SalesCode]
           ,Sum(b.Order_Quantity - b.Shipped_Quantity)                            As [OpenQty]
           ,Cast(b.Order_Date As Date)                                            As [OrderDate]
     As [PromDate] 
     As [WorkCenter] 
    from [PRODUCTION].dbo.Job As b
    left outer join [PRODUCTION].dbo.Material As Mb
          on b.Part_Number = Mb.Material
    Where b.Status = 'Active' and Mb.Type = 'F' and b.Job Not like '%MASTER%' and b.Customer IS null
    GROUP BY b.Part_Number, b.Job, [S-J], Mb.Sales_Code, Mb.Lead_Days, b.Order_Date, b.Description
    )b
    full join
    Select c.Part_Number                                                          As [Part_Number]
           ,ISNULL(c.Description,'')                                              As [Description]
           ,Mc.Lead_Days                                                          As [LD]
           ,'00000'                                                               As [SalesOrder]
     As [Ln]
           ,'J'                                                                  
    As [S/J]
           ,c.Job                                                                
    As [Job]
           ,Mc.Sales_Code                                                         As [SalesCode]
           ,'0'                                                                  
    As [OpenQty]
           ,Cast(c.Order_Date As Date)                                            As [OrderDate]
     As [PromDate]  
           ,Max(Case when JO.Work_Center = 'INSPECTION'                                         and JO.Status = 'O'        
                   then '00 NOT STARTED'
                     when JO.Work_Center = 'INSPECTION'                                         and JO.Status = 'S'
                           then '90 INSPECTION'
                     when JO.Work_Center = 'INSPECTION'                                         and JO.Status = 'C'
                           then '95 COMPLETED'
                     When JO.Work_Center like '%WELD%'                                          and JO.Status =
    'O'                        then '05 NOT STARTED'
                     when JO.Work_Center like '%WELD%'                                          and JO.Status =
    'S'                        then '70 WELD'
                     when JO.Work_Center like '%WELD%'                                          and JO.Status =
    'C'                        then '75 WELD'
                     when JO.Work_Center = 'KITTING'                                            and JO.Status
    = 'O'                        then '05 NOT STARTED'
                     when JO.Work_Center = 'KITTING'                                            and JO.Status
    = 'S'                        then '60 KITTING'
                     when JO.Work_Center = 'KITTING'                                            and JO.Status
    = 'C'                        then '65 KITTED'
                     when JO.Work_Center = 'WIREBENDER'                                         and JO.Status = 'O'
                           then '15 NOT STARTED'
                     when JO.Work_Center = 'WIREBENDER'                                         and JO.Status = 'S'
                           then '50 WIRE BENDING'
                     when JO.Work_Center = 'WIREBENDER'                                         and JO.Status = 'C'
                           then '55 WIRE BENT'
                     when JO.Work_Center = 'TUBEBENDER' and JO.Operation_Service = 'BEND TUBES' and JO.Status = 'O'                        then '20 NOT STARTED'
                     when JO.WOrk_Center = 'TUBEBENDER' and JO.Operation_Service = 'BEND TUBES' and JO.Status = 'S'                        then '40 BENDING
    TUBES'
                     when JO.Work_Center = 'TUBEBENDER' and JO.Operation_Service = 'BEND TUBES' and JO.Status = 'C'                        then '45 TUBES BENT'
                     when JO.Work_Center = 'TUBEBENDER' and JO.Operation_Service = 'CUT TUBES'  and JO.Status = 'O'                        then '25 NOT
    STARTED'
                     when JO.Work_Center = 'TUBEBENDER' and JO.Operation_Service = 'CUT TUBES'  and JO.Status = 'S'                        then '30 CUTTING
    TUBES'
                     when JO.Work_Center = 'TUBEBEnder' and JO.Operation_Service = 'CUT TUBES'  and JO.Status = 'C'                        then '35 TUBES
    CUT'
           else '' end) [WorkCenter]
    from [PRODUCTION].dbo.Job_Operation As JO
    left outer join [PRODUCTION].dbo.Job as c
          on c.Job = JO.Job
    left outer join [PRODUCTION].dbo.Material As Mc
          on c.Part_Number = Mc.Material
    Where c.Status = 'Active' and Mc.Type = 'F' and c.Job Not like '%MASTER%' and c.Customer IS null
    GROUP BY c.Part_Number, c.Job, [S/J], Mc.SalesCode, Mc.Lead_Days, c.Order_Date, c.Description
    )c
    on a.[Material] = b.[Part_Number] and a.[Material] = c.[Part_Number] and a.[Job] = b.[Job] and a.[Job] = c.[Job] and a.[PromDate] = b.[PromDate] and a.[PromDate] = c.[PromDate]
    Order by COALESCE(b.[Part_Number],a.[Material],c.[Part_Number],b.[Job],a.[Job],c.[Job],b.[S/J],a.[S/J],c.[S/J])
    ERROR MESSAGE **********************************************************************************************
    Msg 156, Level 15, State 1, Line 99
    Incorrect syntax near the keyword 'Order'.
    DDL SO_DETAIL *********************************************************************************************
    USE [PRODUCTION]
    GO
    /****** Object:  Table [dbo].[SO_Detail]    Script Date: 05/22/2014 11:41:09 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[SO_Detail](
    [SO_DetailKey] [dbo].[KeyNum] IDENTITY(1,1) NOT NULL,
    [SO_Detail] [dbo].[KeyNum] NULL,
    [Sales_Order] [dbo].[Key10] NOT NULL,
    [SO_Line] [dbo].[T_6] NOT NULL,
    [PO] [dbo].[Key8] NULL,
    [Line] [dbo].[T_6] NULL,
    [Material] [dbo].[T_30] NULL,
    [Ship_To] [int] NULL,
    [Drop_Ship] [bit] NOT NULL,
    [Quote] [varchar](50) NULL,
    [Job] [dbo].[Key10] NULL,
    [Status] [dbo].[T_9] NOT NULL,
    [Make_Buy] [dbo].[T_1] NOT NULL,
    [Unit_Price] [float] NOT NULL,
    [Discount_Pct] [float] NOT NULL,
    [Price_UofM] [dbo].[UofM] NOT NULL,
    [Total_Price] [money] NOT NULL,
    [Deferred_Qty] [float] NOT NULL,
    [Prepaid_Amt] [money] NOT NULL,
    [Unit_Cost] [float] NOT NULL,
    [Order_Qty] [float] NOT NULL,
    [Stock_UofM] [dbo].[UofM] NOT NULL,
    [Backorder_Qty] [float] NOT NULL,
    [Picked_Qty] [float] NOT NULL,
    [Shipped_Qty] [float] NOT NULL,
    [Returned_Qty] [float] NOT NULL,
    [Certs_Required] [bit] NOT NULL,
    [Taxable] [bit] NOT NULL,
    [Commissionable] [bit] NOT NULL,
    [Commission_Pct] [float] NOT NULL,
    [Sales_Code] [dbo].[T_UCode] NULL,
    [Note_Text] [text] NULL,
    [Promised_Date] [datetime] NULL,
    [Last_Updated] [datetime] NOT NULL,
    [Description] [dbo].[T_30] NULL,
    [Price_Unit_Conv] [float] NULL,
    [Rev] [dbo].[T_8] NULL,
    [Tax_Code] [dbo].[T_15] NULL,
    [Ext_Description] [text] NULL,
    [Cost_UofM] [dbo].[T_4] NULL,
    [Cost_Unit_Conv] [float] NULL,
    [Res_Type] [smallint] NULL,
    [Res_ID] [dbo].[T_50] NULL,
    [Res_Qty] [float] NULL,
    [Partial_Res] [bit] NULL,
    [Prepaid_Trade_Amt] [money] NULL,
    [ObjectID] [uniqueidentifier] NOT NULL,
     CONSTRAINT [PK_SO_Detail] PRIMARY KEY NONCLUSTERED 
    [SO_DetailKey] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[SO_Detail]  WITH NOCHECK ADD  CONSTRAINT [FK_SOH_on_SODetl] FOREIGN KEY([Sales_Order])
    REFERENCES [dbo].[SO_Header] ([Sales_Order])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[SO_Detail] NOCHECK CONSTRAINT [FK_SOH_on_SODetl]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Drop_Ship]  DEFAULT ((0)) FOR [Drop_Ship]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Status]  DEFAULT ('Open') FOR [Status]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Make_Buy]  DEFAULT ('M') FOR [Make_Buy]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Discount_Pct]  DEFAULT ((0)) FOR [Discount_Pct]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Price_UofM]  DEFAULT ('ea') FOR [Price_UofM]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Deferred_Qty]  DEFAULT ((0)) FOR [Deferred_Qty]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Prepaid_Amt]  DEFAULT ((0)) FOR [Prepaid_Amt]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Order_Qty]  DEFAULT ((0)) FOR [Order_Qty]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Backorder_Qty]  DEFAULT ((0)) FOR [Backorder_Qty]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Picked_Qty]  DEFAULT ((0)) FOR [Picked_Qty]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Certs_Required]  DEFAULT ((0)) FOR [Certs_Required]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Taxable]  DEFAULT ((0)) FOR [Taxable]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Commissionable]  DEFAULT ((0)) FOR [Commissionable]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Commission_Pct]  DEFAULT ((0)) FOR [Commission_Pct]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SO_Detail_Last_Updated]  DEFAULT (getdate()) FOR [Last_Updated]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  CONSTRAINT [DF_SODetail_PriceUofM]  DEFAULT ((1)) FOR [Price_Unit_Conv]
    GO
    ALTER TABLE [dbo].[SO_Detail] ADD  DEFAULT ((0)) FOR [Prepaid_Trade_Amt]
    GO
    DDL Material ************************************************************************************************************************************
    USE [PRODUCTION]
    GO
    /****** Object:  Table [dbo].[Material]    Script Date: 05/22/2014 11:42:02 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Material](
    [Material] [dbo].[Key30] NOT NULL,
    [Primary_Vendor] [dbo].[Key10] NULL,
    [User_Values] [dbo].[KeyNum] NULL,
    [Shape] [dbo].[Key10] NULL,
    [Location_ID] [dbo].[Key10] NOT NULL,
    [Sales_Code] [dbo].[T_15] NULL,
    [Description] [dbo].[T_30] NULL,
    [Type] [dbo].[T_1] NOT NULL,
    [Status] [dbo].[T_8] NOT NULL,
    [Pick_Buy_Indicator] [dbo].[T_1] NOT NULL,
    [Class] [varchar](10) NULL,
    [Rev] [dbo].[T_8] NULL,
    [Stocked_UofM] [dbo].[UofM] NOT NULL,
    [Purchase_UofM] [dbo].[UofM] NOT NULL,
    [Cost_UofM] [dbo].[UofM] NOT NULL,
    [Price_UofM] [dbo].[UofM] NOT NULL,
    [Selling_Price] [float] NULL,
    [Standard_Cost] [float] NOT NULL,
    [Average_Cost] [float] NULL,
    [Last_Cost] [float] NULL,
    [On_Order_Qty] [float] NULL,
    [Order_Point] [float] NULL,
    [Reorder_Qty] [float] NOT NULL,
    [Lead_Days] [smallint] NOT NULL,
    [UofM_Conv_Factor] [float] NOT NULL,
    [Lot_Trace] [bit] NOT NULL,
    [Rd_Whole_Unit] [bit] NOT NULL,
    [Ext_Description] [text] NULL,
    [Make_Buy] [dbo].[T_1] NOT NULL,
    [Vendor_Reference] [dbo].[T_30] NULL,
    [Drawing] [varchar](30) NULL,
    [Use_Price_Breaks] [bit] NOT NULL,
    [Note_Text] [text] NULL,
    [Last_Updated] [datetime] NOT NULL,
    [GL_Account] [dbo].[T_100] NULL,
    [Price_Unit_Conv] [float] NULL,
    [Holder_ID] [dbo].[T_50] NULL,
    [Job] [dbo].[T_10] NULL,
    [Tax_Code] [dbo].[T_15] NULL,
    [Taxable] [bit] NULL,
    [IS_Length] [float] NULL,
    [IS_Width] [float] NULL,
    [IS_Weight_Factor] [float] NULL,
    [IS_Thickness] [float] NULL,
    [Stock_Item] [dbo].[T_50] NULL,
    [Affects_Schedule] [bit] NULL,
    [ObjectID] [uniqueidentifier] NOT NULL,
    [Shape_OID] [uniqueidentifier] NULL,
    [Tooling] [bit] NULL,
    [IsSerialized] [bit] NOT NULL,
    [MaxUsage] [int] NULL,
    [ShelfLife] [float] NULL,
    [ShelfLifeUofM] [varchar](10) NULL,
     CONSTRAINT [PK_Material] PRIMARY KEY NONCLUSTERED 
    [Material] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[Material]  WITH NOCHECK ADD  CONSTRAINT [FK_Loc_on_Matl] FOREIGN KEY([Location_ID])
    REFERENCES [dbo].[Location] ([Location_ID])
    GO
    ALTER TABLE [dbo].[Material] NOCHECK CONSTRAINT [FK_Loc_on_Matl]
    GO
    ALTER TABLE [dbo].[Material]  WITH NOCHECK ADD  CONSTRAINT [FK_Shap_on_Matl] FOREIGN KEY([Shape])
    REFERENCES [dbo].[Shapes] ([Shape])
    GO
    ALTER TABLE [dbo].[Material] NOCHECK CONSTRAINT [FK_Shap_on_Matl]
    GO
    ALTER TABLE [dbo].[Material]  WITH NOCHECK ADD  CONSTRAINT [FK_UVal_on_Matl] FOREIGN KEY([User_Values])
    REFERENCES [dbo].[User_Values] ([User_Values])
    GO
    ALTER TABLE [dbo].[Material] NOCHECK CONSTRAINT [FK_UVal_on_Matl]
    GO
    ALTER TABLE [dbo].[Material]  WITH NOCHECK ADD  CONSTRAINT [FK_Vend_on_Matl] FOREIGN KEY([Primary_Vendor])
    REFERENCES [dbo].[Vendor] ([Vendor])
    GO
    ALTER TABLE [dbo].[Material] NOCHECK CONSTRAINT [FK_Vend_on_Matl]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Selling_Price]  DEFAULT ((0)) FOR [Selling_Price]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Standard_Cost]  DEFAULT ((0)) FOR [Standard_Cost]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Average_Cost]  DEFAULT ((0)) FOR [Average_Cost]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Last_Cost]  DEFAULT ((0)) FOR [Last_Cost]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_On_Order_Qty]  DEFAULT ((0)) FOR [On_Order_Qty]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Order_Point]  DEFAULT ((0)) FOR [Order_Point]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Reorder_Qty]  DEFAULT ((0)) FOR [Reorder_Qty]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Lead_Days]  DEFAULT ((0)) FOR [Lead_Days]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_UofM_Conv_Factor]  DEFAULT ((0)) FOR [UofM_Conv_Factor]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Lot_Trace]  DEFAULT ((0)) FOR [Lot_Trace]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Rd_Whole_Unit]  DEFAULT ((0)) FOR [Rd_Whole_Unit]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Use_Price_Break]  DEFAULT ((0)) FOR [Use_Price_Breaks]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_Last_Updated]  DEFAULT (getdate()) FOR [Last_Updated]
    GO
    ALTER TABLE [dbo].[Material] ADD  CONSTRAINT [DF_Material_PriceUofM]  DEFAULT ((1)) FOR [Price_Unit_Conv]
    GO
    ALTER TABLE [dbo].[Material] ADD  DEFAULT ((0)) FOR [IsSerialized]
    GO
    ALTER TABLE [dbo].[Material] ADD  DEFAULT ((0)) FOR [MaxUsage]
    GO
    ALTER TABLE [dbo].[Material] ADD  DEFAULT ((0)) FOR [ShelfLife]
    GO
    DDL SO_HEADER ***************************************************************************************************************
    USE [PRODUCTION]
    GO
    /****** Object:  Table [dbo].[SO_Header]    Script Date: 05/22/2014 11:43:29 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[SO_Header](
    [Sales_Order] [dbo].[Key10] NOT NULL,
    [Customer] [dbo].[Key10] NOT NULL,
    [Ship_To] [dbo].[KeyNum] NULL,
    [Contact] [dbo].[KeyNum] NULL,
    [Sales_Rep] [dbo].[Key6] NULL,
    [Order_Taken_By] [dbo].[Key6] NULL,
    [Ship_Via] [dbo].[T_UCode] NULL,
    [Tax_Code] [dbo].[T_UCode] NULL,
    [Terms] [dbo].[T_UCode] NULL,
    [Sales_Tax_Amt] [money] NOT NULL,
    [Sales_Tax_Rate] [float] NOT NULL,
    [Order_Date] [datetime] NOT NULL,
    [Promised_Date] [datetime] NULL,
    [Customer_PO] [dbo].[T_20] NULL,
    [Status] [dbo].[T_8] NOT NULL,
    [Total_Price] [money] NOT NULL,
    [Currency_Conv_Rate] [float] NOT NULL,
    [Trade_Currency] [dbo].[KeyNum] NULL,
    [Fixed_Rate] [bit] NOT NULL,
    [Trade_Date] [datetime] NULL,
    [Note_Text] [text] NULL,
    [Comment] [text] NULL,
    [Last_Updated] [datetime] NOT NULL,
    [User_Values] [int] NULL,
    [Source] [dbo].[T_20] NULL,
    [Prepaid_Tax_Amount] [money] NULL,
     CONSTRAINT [PK_SO_Header] PRIMARY KEY NONCLUSTERED 
    [Sales_Order] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  CONSTRAINT [DF_SO_Header_Sales_Tax_Amt]  DEFAULT ((0)) FOR [Sales_Tax_Amt]
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  CONSTRAINT [DF_SO_Header_Sales_Tax_Rate]  DEFAULT ((0)) FOR [Sales_Tax_Rate]
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  CONSTRAINT [DF_SO_Header_Total_Price]  DEFAULT ((0)) FOR [Total_Price]
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  CONSTRAINT [DF_SO_Header_Currency_Conv_Rate]  DEFAULT ((1)) FOR [Currency_Conv_Rate]
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  CONSTRAINT [DF_SO_Header_Fixed_Rate]  DEFAULT ((1)) FOR [Fixed_Rate]
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  CONSTRAINT [DF_SO_Header_Last_Updated]  DEFAULT (getdate()) FOR [Last_Updated]
    GO
    ALTER TABLE [dbo].[SO_Header] ADD  DEFAULT ((0)) FOR [Prepaid_Tax_Amount]
    GO
    DDL JOB *******************************************************************************************************************************
    USE [PRODUCTION]
    GO
    /****** Object:  Table [dbo].[Job]    Script Date: 05/22/2014 11:44:43 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Job](
    [Job] [dbo].[Key10] NOT NULL,
    [Sales_Rep] [dbo].[Key6] NULL,
    [Customer] [dbo].[Key10] NULL,
    [Ship_To] [dbo].[KeyNum] NULL,
    [User_Values] [dbo].[KeyNum] NULL,
    [Quote] [dbo].[Key10] NULL,
    [Contact] [dbo].[KeyNum] NULL,
    [Ship_Via] [dbo].[T_15] NULL,
    [Terms] [dbo].[T_15] NULL,
    [Tax_Code] [dbo].[T_15] NULL,
    [Sales_Code] [dbo].[T_15] NULL,
    [Top_Lvl_Job] [dbo].[T_10] NULL,
    [Type] [dbo].[T_8] NOT NULL,
    [Order_Date] [datetime] NOT NULL,
    [Status] [dbo].[T_8] NOT NULL,
    [Status_Date] [datetime] NOT NULL,
    [Part_Number] [dbo].[T_30] NULL,
    [Rev] [dbo].[T_10] NULL,
    [Description] [dbo].[T_30] NULL,
    [Ext_Description] [text] NULL,
    [Drawing] [varchar](30) NULL,
    [Build_To_Stock] [bit] NOT NULL,
    [Order_Quantity] [int] NOT NULL,
    [Extra_Quantity] [int] NULL,
    [Pick_Quantity] [int] NULL,
    [Make_Quantity] [int] NOT NULL,
    [Split_Quantity] [int] NULL,
    [Completed_Quantity] [int] NULL,
    [Shipped_Quantity] [int] NULL,
    [FG_Transfer_Qty] [int] NULL,
    [Returned_Quantity] [int] NULL,
    [In_Production_Quantity] [int] NOT NULL,
    [Assembly_Level] [smallint] NULL,
    [Certs_Required] [bit] NOT NULL,
    [Time_And_Materials] [bit] NOT NULL,
    [Open_Operations] [smallint] NULL,
    [Scrap_Pct] [float] NOT NULL,
    [Est_Scrap_Qty] [int] NULL,
    [Est_Rem_Hrs] [float] NULL,
    [Est_Total_Hrs] [float] NULL,
    [Est_Labor] [money] NULL,
    [Est_Material] [money] NULL,
    [Est_Service] [money] NULL,
    [Est_Labor_Burden] [money] NULL,
    [Est_Machine_Burden] [money] NULL,
    [Est_GA_Burden] [money] NULL,
    [Act_Revenue] [money] NULL,
    [Act_Scrap_Quantity] [int] NULL,
    [Act_Total_Hrs] [float] NULL,
    [Act_Labor] [money] NULL,
    [Act_Material] [money] NULL,
    [Act_Service] [money] NULL,
    [Act_Labor_Burden] [money] NULL,
    [Act_Machine_Burden] [money] NULL,
    [Act_GA_Burden] [money] NULL,
    [Priority] [smallint] NULL,
    [Unit_Price] [float] NULL,
    [Total_Price] [money] NULL,
    [Price_UofM] [dbo].[T_4] NULL,
    [Currency_Conv_Rate] [float] NOT NULL,
    [Trade_Currency] [dbo].[KeyNum] NULL,
    [Fixed_Rate] [bit] NOT NULL,
    [Trade_Date] [datetime] NULL,
    [Commission_Pct] [float] NULL,
    [Customer_PO] [dbo].[T_20] NULL,
    [Customer_PO_LN] [dbo].[T_6] NULL,
    [Sched_End] [datetime] NULL,
    [Sched_Start] [datetime] NULL,
    [Quantity_Per] [float] NULL,
    [Profit_Pct] [float] NULL,
    [Labor_Markup_Pct] [float] NOT NULL,
    [Mat_Markup_Pct] [float] NOT NULL,
    [Serv_Markup_Pct] [float] NOT NULL,
    [Labor_Burden_Markup_Pct] [float] NOT NULL,
    [Machine_Burden_Markup_Pct] [float] NOT NULL,
    [GA_Burden_Markup_Pct] [float] NOT NULL,
    [Lead_Days] [smallint] NULL,
    [Profit_Markup] [dbo].[T_1] NULL,
    [Prepaid_Amt] [money] NULL,
    [Split_To_Job] [bit] NOT NULL,
    [Note_Text] [text] NULL,
    [Comment] [text] NULL,
    [Last_Updated] [datetime] NOT NULL,
    [Order_Unit] [dbo].[T_4] NULL,
    [Price_Unit_Conv] [float] NULL,
    [Holder_ID] [dbo].[T_50] NULL,
    [Source] [dbo].[T_20] NULL,
    [Order_Taken_By] [dbo].[T_50] NULL,
    [Plan_Modified] [bit] NULL,
    [ObjectID] [uniqueidentifier] NOT NULL,
    [Released_Date] [datetime] NULL,
    [Prepaid_Tax_Amount] [money] NULL,
    [Prepaid_Trade_Amt] [money] NULL,
    [Last_Updated_By] [dbo].[T_50] NULL,
     CONSTRAINT [PK_Job] PRIMARY KEY NONCLUSTERED 
    [Job] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    ALTER TABLE [dbo].[Job]  WITH NOCHECK ADD  CONSTRAINT [FK_Addr_on_Job] FOREIGN KEY([Ship_To])
    REFERENCES [dbo].[Address] ([Address])
    GO
    ALTER TABLE [dbo].[Job] NOCHECK CONSTRAINT [FK_Addr_on_Job]
    GO
    ALTER TABLE [dbo].[Job]  WITH NOCHECK ADD  CONSTRAINT [FK_Cust_on_Job] FOREIGN KEY([Customer])
    REFERENCES [dbo].[Customer] ([Customer])
    GO
    ALTER TABLE [dbo].[Job] NOCHECK CONSTRAINT [FK_Cust_on_Job]
    GO
    ALTER TABLE [dbo].[Job]  WITH NOCHECK ADD  CONSTRAINT [FK_Empl_on_Job] FOREIGN KEY([Sales_Rep])
    REFERENCES [dbo].[Employee] ([Employee])
    GO
    ALTER TABLE [dbo].[Job] NOCHECK CONSTRAINT [FK_Empl_on_Job]
    GO
    ALTER TABLE [dbo].[Job]  WITH NOCHECK ADD  CONSTRAINT [FK_UVal_on_Job] FOREIGN KEY([User_Values])
    REFERENCES [dbo].[User_Values] ([User_Values])
    GO
    ALTER TABLE [dbo].[Job] NOCHECK CONSTRAINT [FK_UVal_on_Job]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Build_To_Stock]  DEFAULT ((0)) FOR [Build_To_Stock]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Order_Quantity]  DEFAULT ((0)) FOR [Order_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Extra_Quantity]  DEFAULT ((0)) FOR [Extra_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Pick_Quantity]  DEFAULT ((0)) FOR [Pick_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Make_Quantity]  DEFAULT ((0)) FOR [Make_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Split_Quantity]  DEFAULT ((0)) FOR [Split_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Completed_Quantity]  DEFAULT ((0)) FOR [Completed_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Shipped_Quantity]  DEFAULT ((0)) FOR [Shipped_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_FG_Transfer_Qty]  DEFAULT ((0)) FOR [FG_Transfer_Qty]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Returned_Quantity]  DEFAULT ((0)) FOR [Returned_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_In_Production_Quantity]  DEFAULT ((0)) FOR [In_Production_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Assembly_Level]  DEFAULT ((0)) FOR [Assembly_Level]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Certs_Required]  DEFAULT ((0)) FOR [Certs_Required]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Time_And_Materials]  DEFAULT ((0)) FOR [Time_And_Materials]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Open_Operations]  DEFAULT ((0)) FOR [Open_Operations]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Scrap_Pct]  DEFAULT ((0)) FOR [Scrap_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Scrap_Qty]  DEFAULT ((0)) FOR [Est_Scrap_Qty]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Rem_Hrs]  DEFAULT ((0)) FOR [Est_Rem_Hrs]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Total_Hrs]  DEFAULT ((0)) FOR [Est_Total_Hrs]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Labor]  DEFAULT ((0)) FOR [Est_Labor]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Material]  DEFAULT ((0)) FOR [Est_Material]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Service]  DEFAULT ((0)) FOR [Est_Service]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Labor_Burden]  DEFAULT ((0)) FOR [Est_Labor_Burden]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_Machine_Burden]  DEFAULT ((0)) FOR [Est_Machine_Burden]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Est_GA_Burden]  DEFAULT ((0)) FOR [Est_GA_Burden]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Revenue]  DEFAULT ((0)) FOR [Act_Revenue]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Scrap_Quantity]  DEFAULT ((0)) FOR [Act_Scrap_Quantity]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Total_Hrs]  DEFAULT ((0)) FOR [Act_Total_Hrs]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Labor]  DEFAULT ((0)) FOR [Act_Labor]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Material]  DEFAULT ((0)) FOR [Act_Material]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Service]  DEFAULT ((0)) FOR [Act_Service]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Labor_Burden]  DEFAULT ((0)) FOR [Act_Labor_Burden]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_Machine_Burden]  DEFAULT ((0)) FOR [Act_Machine_Burden]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Act_GA_Burden]  DEFAULT ((0)) FOR [Act_GA_Burden]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Priority]  DEFAULT ((5)) FOR [Priority]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Unit_Price]  DEFAULT ((0)) FOR [Unit_Price]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Total_Price]  DEFAULT ((0)) FOR [Total_Price]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Currency_Conv_Rate]  DEFAULT ((1)) FOR [Currency_Conv_Rate]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Fixed_Rate]  DEFAULT ((1)) FOR [Fixed_Rate]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Commission_Pct]  DEFAULT ((0)) FOR [Commission_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Quantity_Per]  DEFAULT ((1)) FOR [Quantity_Per]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Profit_Pct]  DEFAULT ((0)) FOR [Profit_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Labor_Markup_Pct]  DEFAULT ((0)) FOR [Labor_Markup_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Mat_Markup_Pct]  DEFAULT ((0)) FOR [Mat_Markup_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Serv_Markup_Pct]  DEFAULT ((0)) FOR [Serv_Markup_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Labor_Burden_Markup_Pct]  DEFAULT ((0)) FOR [Labor_Burden_Markup_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Machine_Burden_Markup_Pct]  DEFAULT ((0)) FOR [Machine_Burden_Markup_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_GA_Burden_Markup_Pct]  DEFAULT ((0)) FOR [GA_Burden_Markup_Pct]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Lead_Days]  DEFAULT ((0)) FOR [Lead_Days]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Prepaid_Amt]  DEFAULT ((0)) FOR [Prepaid_Amt]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Split_To_Job]  DEFAULT ((0)) FOR [Split_To_Job]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_Job_Last_Updated]  DEFAULT (getdate()) FOR [Last_Updated]
    GO
    ALTER TABLE [dbo].[Job] ADD  CONSTRAINT [DF_JOB_PriceUofM]  DEFAULT ((1)) FOR [Price_Unit_Conv]
    GO
    ALTER TABLE [dbo].[Job] ADD  DEFAULT ((0)) FOR [Prepaid_Tax_Amount]
    GO
    ALTER TABLE [dbo].[Job] ADD  DEFAULT ((0)) FOR [Prepaid_Trade_Amt]
    GO
    Order by COALESCE(b.[Part_Number],a.[Material],c.[Part_Number],b.[Job],a.[Job],c.[Job],b.[S/J],a.[S/J],c.[S/J])
    SWProduction

    Given exactly what you posted, there is a stray order by clause in the last batch of your script and it is the only statement in the batch.  Unfortunately, it is likely that something was mangled - which is why it is better to use the [insert code block]
    function as opposed to just copying the entire script into the text of the post.
    To short circuit things a bit, your join syntax is off.  You are joining a to b to c, so the basic structure of your statement should be:
    select
    from a join b on ...
    join c on ...
    where ...
    If you used CTEs instead of derived tables it might be easier for you to visually see that.  As a simple demonstration, consider:
    with ctea as (select 1 as id union all select 2),
    cteb as (select 1 as id union all select 3),
    ctec as (select 1 as id union all select 2 union all select 5)
    select *
    from ctea
    full join cteb on ctea.id = cteb.id
    full join ctec on ctea.id = ctec.id
    order by coalesce(cteb.id, ctea.id, ctec.id);
    go
    with ctea as (select 1 as id union all select 2),
    cteb as (select 1 as id union all select 3),
    ctec as (select 1 as id union all select 2 union all select 5)
    select *
    from ctea
    full join cteb
    full join ctec on ctea.id = cteb.id and ctea.id = ctec.id
    order by coalesce(cteb.id, ctea.id, ctec.id);
     And a last comment which I leave as a hint - do you really need those left joins in your derived tables?

  • Syntax error when creating a user-defined table type in SQL Server 2012

    Why am I getting a syntax error when creating a user-defined table type in SQL Server 2014?
    CREATE TYPE ReportsTableType AS TABLE 
    ( reportId INT
    , questionId INT
    , questionOrder INT );
    Results:
    Msg 156, Level 15, State 1, Line 1
    Incorrect syntax near the keyword 'AS'.

    Hope these posts could help, 
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/37a45a9a-ed8c-4655-be93-f6e6d5ef44be/getting-incorrect-syntax-while-creating-a-table-type-in-sql-server-2008-r2?forum=transactsql
    Regards, Dineshkumar,
    Please Mark as Answer if my post answers your question and
    Vote as Helpful if it helps you

  • Getting syntax error while running ODI project

    Greetings,
    First time here with ODI. I'm using ODI version 10.1.3.5 and get the following error below on execution. I'm reading from a flat file to a mssql table. Not sure if this matters, but ODI is installed on one server running sql2005, while the staging tables are on a different server running 2008. The C$_ table is created, but contains no data.
    156 : S0001 : com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'TABLE'.
    com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'TABLE'.
         at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1493)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)
         at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)
         at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)
         at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)
         at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:283)
         at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:595)
    Many thanks.

    Hi Lanfir,
    I'm not sure where the sql gets generated, although I see why the code fails (I think). Sql is expecting a real table name but insteas gets either a blank name or the comment /* */. Is that correct?
    This is what the error is saying at the operator.
    Loading: Query / Execution Plan
    ====================
    select     SETID     C3_SETID,
         CUSTNUM     C2_CUSTNUM,
         CUSTDESC     C1_CUSTDESC
    from      TABLE
    /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=CUSTOMERSNP$CRLOAD_FILE=
    D:\Automation\ODI\HCCPREV\PS\Actual/CustomerMeta.txtSNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=09
    SNP$CRFILE_SEP_LINE=0D0ASNP$CRFILE_FIRST_ROW=1SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP
    $CRDWG_COLSNP$CRCOL_NAME=SETIDSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=50
    SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=CUSTNUMSNP$CRTYPE_NAME=STRINGSNP$CRORDER=2SNP$CRLENGTH=50SNP
    $CRPRECISION=50SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=CUSTDESCSNP$CRTYPE_NAME=STRINGSNP$CRORDER=3SNP
    $CRLENGTH=250SNP$CRPRECISION=250SNP$CR$$SNPS_END_KEY*/
    Default: Query / Execution Plan
    ====================
    insert into EPMAInterfaceTST.dbo.C$_0NEW_CustomerTST
         C3_SETID,
         C2_CUSTNUM,
         C1_CUSTDESC
    values
         :C3_SETID,
         :C2_CUSTNUM,
         :C1_CUSTDESC
    )

  • Trouble using the "into" keyword in a select statement

    I was able to run the below query fine:
    SELECT QTTYP.Qt_Grp, 
    CFQR.ReferralCode, 
    CFQR.RecKey, 
    Count(CFQR.RecKey) AS Cnt
    FROM [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals as CFQR 
    INNER JOIN [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs as QTTYP 
    ON CFQR.QuoteType = QTTYP.Qt_Grp
    WHERE (((CFQR.QuoteType) Not In ('AUTO/CYCLE','COMMERCIAL','CYCLE')) 
    AND ((CFQR.QuoteDate)>=DateAdd("m",-15,CONVERT (date, GETDATE())))
    AND ((CFQR.RecCntdAsRefrl)=1))
    GROUP BY QTTYP.Qt_Grp, 
    CFQR.ReferralCode, 
    CFQR.RecKey, 
    CFQR.RecChangeID
    HAVING (((Count(CFQR.RecKey))>1) AND ((CFQR.RecChangeID) Is Null)) 
    OR (((Count(CFQR.RecKey))>1) 
    AND ((CFQR.RecChangeID) Not In (1035)))
    ORDER BY QTTYP.Qt_Grp, CFQR.RecKey;
    I am trying to add the output columns into a temp table. But when I add the "into" statement, as shown below, it gives me errors:
    SELECT QTTYP.Qt_Grp, 
    CFQR.ReferralCode, 
    CFQR.RecKey, 
    Count(CFQR.RecKey) AS Cnt
    FROM [HR_DEV_DM].[CFQ_TEST].CFQ_Referrals as CFQR 
    into I_Dup_RecKey_Check_01
    INNER JOIN [HR_DEV_DM].[CFQ_TEST].t_Qt_Typs as QTTYP 
    ON CFQR.QuoteType = QTTYP.Qt_Grp
    WHERE (((CFQR.QuoteType) Not In ('AUTO/CYCLE','COMMERCIAL','CYCLE')) 
    AND ((CFQR.QuoteDate)>=DateAdd("m",-15,CONVERT (date, GETDATE())))
    AND ((CFQR.RecCntdAsRefrl)=1))
    GROUP BY QTTYP.Qt_Grp, 
    CFQR.ReferralCode, 
    CFQR.RecKey, 
    CFQR.RecChangeID
    HAVING (((Count(CFQR.RecKey))>1) AND ((CFQR.RecChangeID) Is Null)) 
    OR (((Count(CFQR.RecKey))>1) 
    AND ((CFQR.RecChangeID) Not In (1035)))
    ORDER BY QTTYP.Qt_Grp, CFQR.RecKey;
    Errors:
    Msg 156, Level 15, State 1, Line 7
    Incorrect syntax near the keyword 'into'.
    Msg 102, Level 15, State 1, Line 11
    Incorrect syntax near 'CFQR'.
    Msg 102, Level 15, State 1, Line 18
    Incorrect syntax near 'Count'.
    Msg 102, Level 15, State 1, Line 19
    Incorrect syntax near 'Count'.
    Please help.....

    You have put INTO into the wrong place :
    SELECT QTTYP.Qt_Grp,
    CFQR.ReferralCode,
    CFQR.RecKey,
    Count(CFQR.RecKey) AS Cnt
    into I_Dup_RecKey_Check_01
    FROM CFQ_Referrals as CFQR
    INNER JOIN t_Qt_Typs as QTTYP
    ON CFQR.QuoteType = QTTYP.Qt_Grp
    WHERE (((CFQR.QuoteType) Not In ('AUTO/CYCLE','COMMERCIAL','CYCLE'))
    AND ((CFQR.QuoteDate)>=DateAdd("m",-15,CONVERT (date, GETDATE())))
    AND ((CFQR.RecCntdAsRefrl)=1))
    GROUP BY QTTYP.Qt_Grp,
    CFQR.ReferralCode,
    CFQR.RecKey,
    CFQR.RecChangeID
    HAVING (((Count(CFQR.RecKey))>1) AND ((CFQR.RecChangeID) Is Null))
    OR (((Count(CFQR.RecKey))>1)
    AND ((CFQR.RecChangeID) Not In (1035)))
    ORDER BY QTTYP.Qt_Grp, CFQR.RecKey;

  • Syntax errors in update query with inner joins and sub query.

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....

    Below is the query:
    UPDATE sp_CFQ_Coord_Corrections 
    INNER JOIN (CFQ_Coord_Corrections 
    INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID) 
    ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID 
    SET CFQ_Coord_Corrections.MatchFound = 1, 
    CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID], 
    sp_CFQ_Coord_Corrections.MatchFound = 1
    WHERE (((CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((sp_CFQ_Coord_Corrections.MatchFound)=0) 
    AND ((CFQ_Coord_Corrections.RecImported)=1) 
    AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT') 
    AND ((CFQ_Referrals.RecCombKey)='No.Match') 
    AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
    Error messages seen when executed:
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'INNER'.
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near 'CFQ_Coord_Corrections'.
    Please help.....
    sp_CFQ_Coord_Corrections is a table and not a stored procedure.
    are these both tables "sp_CFQ_Coord_Corrections" and "CFQ_Coord_Corrections" different ??

  • @prompt syntax error with Optional

    Hi Everyone,
    My first post here, hope you guys can help me out. I have some predeifned conditions on a UDT universe which does not parse but works fine. However, In IDT i am making the same but unable. As I have seen so far with the .UNX universe any predefined conditions which does not parse on IDT does not work on the report as well unlike UNV universe. So here is my issue:
    This does not parse on .UNV but works fine on the report:
    convert(varchar, Vw_Ln_Umb.rim_no)  =  @Prompt('Customer No:','A','Limit Details\Customer No.',Mono,Free,Not_Persistent,{'ALL',}) OR 'ALL' =
    @variable('Customer No:')
    I have corrected the mistake of the 7th parameter which is the default value as follows:
    convert(varchar, Vw_Ln_Umb.rim_no) = @Prompt('Customer No:','A','Limit Details\Customer No.',Mono,Free,Not_Persistent,{'ALL'})
    OR 'ALL' =  @variable('Customer No:')
    and i get the following error : Incorrect syntax near the keyword 'OR'.
    When I remove the "OR 'ALL' =  @variable('Customer No:')"
    I get the error: Incorrect syntax near ')'.
    So i have to correct the filter condition as
    convert(varchar, Vw_Ln_Umb.rim_no) = @Prompt('Customer No:','A','Limit Details\Customer No.',Mono,Free,Not_Persistent)
    but this does not allow me to have ALL as the default value which inturn acts as an optional prompt at report level.
    Kindly help me either fix this or create pre-defined conditions with optional prompts.
    Mahee

    Hi mahee,
    Apply this filter condition
    if you want to select single value in report use "Mono"
    Vw_Ln_Umb.rim_no = @Prompt('Customer No:','N','Limit Details\Customer No.',Mono,Free,Not_Persistent)
    if you want to select multiple value in report use "Multi"
    Vw_Ln_Umb.rim_no IN @Prompt('Customer No:','N','Limit Details\Customer No.',Multi,Free,Not_Persistent)
    Remove extra comma in your filter condition.
    Regards
    Mustafa

  • Incorrect CF Syntax Near And

    Looks like createodbcdate is upset with me - I have attached
    the parameters and the query in the code. If you need more let me
    know. Maybe someone can shed some light. Thanks in advance.
    - Jon
    Error Executing Database Query.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect
    syntax near the keyword 'AND'.
    The error occurred in
    /var/www/vhosts/company/httpdocs/sales/dsp_homepage.cfm: line 190
    188 : FROM Payment_BreakDown
    189 : WHERE ContractID = #GetOperatorName.ContractID#
    190 : AND DateAdded <=
    #createodbcdate(attributes.checks_end)#
    191 :
    192 : </cfquery>

    What happens if you change this
    AND DateAdded <= #createodbcdate(attributes.checks_end)#
    to this
    AND DateAdded <= <cfqueryparam
    value="#attributes.checks_end#" cfsqltype="CF_SQL_TIMESTAMP">
    Also, what is the data type of ContractID? If it isn't
    actually numeric, then you'll need single quotes around
    '#GetOperatorName.ContractID#'
    Phil

  • UDV Syntax Issue

    Hello Experts,
    The following UDV code works until I add the WHERE clause, at which time I get a syntax error near keyword WHERE:
    DECLARE @x INTEGER
    SET @x = $[$3.2.NUMBER] WHERE $[$3.1.0] = 'Mileage'
    SELECT CASE
    WHEN @x BETWEEN 1 AND 19 THEN 10
    WHEN @x BETWEEN 20 AND 39 THEN 20
    WHEN @x > 39 THEN 30
    END
    (This is basically retrieving a value from column 2 of a matrix where column 1 has a value of 'Mileage'.)
    SELECT $[$3.2.NUMBER] WHERE $[$3.1.0] = 'Mileage' works as a separate query, but I cannot get that functionality into my above code.
    Regards

    Solved, just needed to bracket it into a subquery.. could have sworn I tried that...
    SET @x = (SELECT $[$3.2.NUMBER] WHERE $[$3.1.0] = 'Mileage')

  • Cyrstal SQL Syntax

    I have the following SQL that I've built via an SQL generator, however I am getting the error message "Error in compiling SQL Expression...Incorrect syntax near the keyword 'SELECT' " when I drop it in an SQL Expression field.
    Can anyone please let me know what needs to be changed in this to function properly with Crystal 2013?
    SELECT
      SalesOrderJobLinks.omjSalesOrderID,
      SalesOrderJobLinks.omjSalesOrderLineID,
      SalesOrderJobLinks.omjSalesOrderDeliveryID,
      SalesOrderDeliveries.omdSalesOrderID,
      SalesOrderDeliveries.omdSalesOrderLineID,
      SalesOrderDeliveries.omdSalesOrderDeliveryID,
      SalesOrderDeliveries.omdDeliveryDate,
      Jobs.jmpJobID,
      SalesOrders.ompSalesOrderID,
      SalesOrderLines.omlSalesOrderID,
      SalesOrderJobLinks.omjJobID,
      SalesOrderLines.omlSalesOrderLineID
    FROM dbo.Jobs
    INNER JOIN dbo.SalesOrderJobLinks
      ON Jobs.jmpJobID = SalesOrderJobLinks.omjJobID
    INNER JOIN dbo.SalesOrders
      ON SalesOrderJobLinks.omjSalesOrderID = SalesOrders.ompSalesOrderID
    INNER JOIN dbo.SalesOrderLines
      ON SalesOrders.ompSalesOrderID = SalesOrderLines.omlSalesOrderID
    INNER JOIN dbo.SalesOrderDeliveries
      ON SalesOrderLines.omlSalesOrderID = SalesOrderDeliveries.omdSalesOrderID
    WHERE Jobs.jmpJobID = '30329-10-p'
    AND SalesOrderDeliveries.omdShippedComplete = 0
    ORDER BY SalesOrderDeliveries.omdDeliveryDate

    Thanks for the suggestion.  I have modified the SQL as shown below.  When I drop this on the report, the report appears to "timeout" and the message "accessing database" continually shows in the status bar.  I have to force close Crystal to stop the process.  Any further suggestions?
    Thanks!
    SELECT
    MIN(SalesOrderDeliveries.omdDeliveryDate)
    FROM dbo.Jobs
    INNER JOIN dbo.SalesOrderJobLinks
    ON "Jobs"."jmpJobID" = "SalesOrderJobLinks"."omjJobID"
    INNER JOIN dbo.SalesOrders
    ON "SalesOrderJobLinks"."omjSalesOrderID" = "SalesOrders"."ompSalesOrderID"
    INNER JOIN dbo.SalesOrderLines
    ON "SalesOrders"."ompSalesOrderID" = "SalesOrderLines"."omlSalesOrderID"
    INNER JOIN dbo.SalesOrderDeliveries
    ON "SalesOrderLines"."omlSalesOrderID" = "SalesOrderDeliveries"."omdSalesOrderID"
    WHERE "SalesOrderDeliveries"."omdShippedComplete" = 0

  • Question about SQL syntax

    Hi,
    I am trying to create a very simple SQL Expression, but can't seem to get the syntax to be valid.  The database connection is to a SQL Server database. If I were to create the query in SQL Server Management Studio, it would be something like
       select LastName from People
    However, every variant I can think of, based on various examples in books and on-line postings, fails syntax check.  These include, among many others:
    select "People"."LastName"
    from "People"
    select "People"."LastName"
    from "PiapDB_ss5"."dbo"."People"
    I have also tried single quotes instead of double quotes.   I keep getting the same error: 
    Database Connector Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid syntax near the keyword 'select'.  [Database vendor code: 156].
    Any suggestions as to the proper syntax?
    Thanks.
    Dan

    an sql expression field is meant to return one value, not records. therefore using a "select * from ..." statement won't work. if you know the select statement will return one value only (e.g. select name from table where id=123), you can surround the statement with parenthesis, that should work.

Maybe you are looking for

  • Need help to analysis "foreground and background wait events" on statspack report for oracle database 11.2.0.4 on AIX

    Hi: I'm analyzing this STATSPACK report: it is "volume test" on our UAT server, so most input is from 'bind variables'.  Our shared pool is well utilized in oracle.  Oracle redo logs is not appropriately configured on this server, as in 'Top 5 wait e

  • Payment terms based on working days

    Dear colleagues I would like to base payment terms on, for example, the last working day of the month, or the last working day of the trimester instead of working with fixed days. Would someone know if this is possible and if so, how can that be arra

  • Business Process Engine in yellow status

    Hi all, I visit the site http://<hostname>:<port>/rep/start/index.jsp and visit the runtime workbench link. Displaying all in the component monitoring, i saw that the business process engine under Integration Server is in yellow status. I checked the

  • Can't get to email without upgrade?

    I have been offline for almost 2 years. now I'm back on and When I try to check email, I get a pop up telling me that to get the best use of the new services that I should upgrade my osx. when I try to do this I'm told there is not enough room to do

  • Need a simple html theme

    Hello everybody, i need a simple just html, no script or flash theme, for doing my photo albums. I have some veryyyy important people (gf and brother :)) than can't see those beacouse they do it on the corporate laptop and all the "bad stuff" are dis