0% found this document useful (0 votes)
33 views

Null

FS2 Database Documentation Generation Date and Time 6 / 29 / 2008 9:23 PM Database Name Logical File Name Physical File Name Current Size Maximum File Size Entire disk Entire disk Growth Rate 36,784 pages 928 pages Database Tables Tables - Display List Database Views Views – Display List.

Uploaded by

api-15542414
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Null

FS2 Database Documentation Generation Date and Time 6 / 29 / 2008 9:23 PM Database Name Logical File Name Physical File Name Current Size Maximum File Size Entire disk Entire disk Growth Rate 36,784 pages 928 pages Database Tables Tables - Display List Database Views Views – Display List.

Uploaded by

api-15542414
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM

Database Name

FS2

Database Files

Logical File Name Physical File Name Current Size Maximum File Growth Rate
Size

FS2_Data E:\SQLDb\FS2_Data.mdf 36,784 pages Entire disk 5%

FS2_Log E:\SQLDb\FS2_Log.LDF 928 pages Entire disk 5%

Database Tables

Tables - Display List

Database Views

Views - Display List

Database Stored Procedures

Stored Procedures - Display List

Database User-Defined Functions

User-Defined Functions - Display List

Database Triggers

Triggers - Display List

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 1
FS2 Database Documentation

Database Tables

Table Name Date Created Revision #

dbo.tbl_FO - Display Details Apr 10 2006 1:37PM 0

dbo.tbl_FO_Comment - Display Details Jan 17 2007 8:31AM 0

dbo.tbl_FO_MI - Display Details Mar 9 2006 5:30PM 0

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 2
FS2 Database Documentation

Database Views

View Name Date Created

dbo._rro_sv_IDOC_Material - Display Details Apr 3 2006 9:45PM

dbo.sv_FO_EquipmentLocked - Display Details Feb 14 2006 12:58PM

dbo.sv_FO_Linking_LinkedList - Display Details Jan 2 2006 9:42AM

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 3
FS2 Database Documentation

Database Stored Procedures

Stored Procedure Name Date Created

dbo._sp_FO_Finish_Old_20071022 - Display Details Oct 22 2007 9:35AM

dbo._sp_FO_MI_PROC_Equipment_List_Old_20071022 - Display Details Oct 22 2007 9:36AM

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 4
FS2 Database Documentation

Database User-Defined Functions

User-Defined Function Name Date Created

dbo.fn_FO_MI_MiCodeID_Get - Display Details Mar 14 2006 1:37PM

dbo.fn_GetDeviation - Display Details Mar 29 2006 3:36PM

dbo.fn_GetFloat - Display Details Mar 22 2006 4:50PM

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 5
FS2 Database Documentation

Database Triggers

Trigger Name Date Created

dbo.tr_MD_EquipmentFOUsage_DELETE - Display Details Mar 21 2006 9:31PM

dbo.tr_MD_EquipmentFOUsage_INSERT - Display Details Mar 21 2006 9:28PM

dbo.tr_MD_ResourceEquipment_DELETE - Display Details Apr 5 2007 9:46AM

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 6
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Table Details

Table Name Revision #

dbo.tbl_FO 0

Table Columns

Column Name Identity? Seed Increment Primary Key? Foreign Key?

FOID Yes 1 1 Yes No

ParentFOID No N/A N/A No FK_tbl_FO_tbl_F


O

FOStatusID No N/A N/A No FK_tbl_FO_tbl_F


S_FOStatus

FOSubStatusID No N/A N/A No No

FOTypeID No N/A N/A No FK_tbl_FO_tbl_F


S_FOType

FOMaterialTypeID No N/A N/A No FK_tbl_FO_tbl_F


S_FOMaterialTyp
e

StreetID No N/A N/A No FK_tbl_FO_tbl_M


D_Street

FONr No N/A N/A No No

Creation No N/A N/A No No

Start No N/A N/A No No

RealStart No N/A N/A No No

Finish No N/A N/A No No

RealFinish No N/A N/A No No

MATNR No N/A N/A No FK_tbl_FO_tbl_M


D_Material

Quant No N/A N/A No No

RealQuant No N/A N/A No No

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 7
FS2 Database Documentation

Scrap No N/A N/A No No

ApotheekStatusID No N/A N/A No FK_tbl_FO_tbl_F


S_ApotheekStatu
s

BulkStatusID No N/A N/A No FK_tbl_FO_tbl_F


S_BulkStatus

PackagingStatusID No N/A N/A No FK_tbl_FO_tbl_F


S_PackagingStat
us

PrintingStatusID No N/A N/A No FK_tbl_FO_tbl_F


S_PrintingStatus

BOM No N/A N/A No No

BOMALT No N/A N/A No No

DataID_Outbound No N/A N/A No FK_tbl_FO_tbl_I


DOC_Data_Outb
ound

DataID_Inbound No N/A N/A No FK_tbl_FO_tbl_I


DOC_Data_Inbou
nd

Column Name Storage Length Nullable? Precision Scale Computed? Default


Type Value

FOID bigint 8 No N/A N/A No Not entered

ParentFOID bigint 8 Yes N/A N/A No Not entered

FOStatusID tinyint 1 Yes N/A N/A No Not entered

FOSubStatusID tinyint 1 Yes N/A N/A No ((0))

FOTypeID tinyint 1 Yes N/A N/A No Not entered

FOMaterialTypeID tinyint 1 Yes N/A N/A No Not entered

StreetID int 4 Yes N/A N/A No Not entered

FONr bigint 8 Yes N/A N/A No Not entered

Creation datetime 8 Yes N/A N/A No Not entered

Start datetime 8 Yes N/A N/A No Not entered

RealStart datetime 8 Yes N/A N/A No Not entered

Finish datetime 8 Yes N/A N/A No Not entered

RealFinish datetime 8 Yes N/A N/A No Not entered

MATNR int 4 Yes N/A N/A No Not entered

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 8
FS2 Database Documentation

Quant float 8 Yes N/A N/A No Not entered

RealQuant float 8 Yes N/A N/A No Not entered

Scrap float 8 Yes N/A N/A No Not entered

ApotheekStatusID tinyint 1 Yes N/A N/A No Not entered

BulkStatusID tinyint 1 Yes N/A N/A No Not entered

PackagingStatusID tinyint 1 Yes N/A N/A No Not entered

PrintingStatusID tinyint 1 Yes N/A N/A No Not entered

BOM tinyint 1 Yes N/A N/A No Not entered

BOMALT tinyint 1 Yes N/A N/A No Not entered

DataID_Outbound bigint 8 Yes N/A N/A No Not entered

DataID_Inbound bigint 8 Yes N/A N/A No Not entered

Record Details

Maximum Record Length 122 bytes

Check Constraints

Check Constraint Name Check Constraint Value

There are no check constraints on this table.

Indexes

Index Name Clustered?

IX_tbl_FO_DataID_Inbound No

IX_tbl_FO_DataID_Outbound No

PK_tbl_FO Yes

Triggers

Trigger Name

dbo.tr_tbl_FO_INSERT

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 9
FS2 Database Documentation

dbo.tr_tbl_FO_UPDATE

Foreign-Key Relationships

Relationship Name Referenced Table Referencing Column Referenced Column

FK_tbl_FO_tbl_FO dbo.tbl_FO ParentFOID FOID

FK_tbl_FO_tbl_FS_ApotheekSta dbo.tbl_FS_ApotheekStatus ApotheekStatusID ApotheekStatusID


tus

FK_tbl_FO_tbl_FS_BulkStatus dbo.tbl_FS_BulkStatus BulkStatusID BulkStatusID

FK_tbl_FO_tbl_FS_FOMaterialT dbo.tbl_FS_FOMaterialType FOMaterialTypeID FOMaterialTypeID


ype

FK_tbl_FO_tbl_FS_FOStatus dbo.tbl_FS_FOStatus FOStatusID FOStatusID

FK_tbl_FO_tbl_FS_FOType dbo.tbl_FS_FOType FOTypeID FOTypeID

FK_tbl_FO_tbl_FS_PackagingSt dbo.tbl_FS_PackagingStatus PackagingStatusID PackagingStatusID


atus

FK_tbl_FO_tbl_FS_PrintingStat dbo.tbl_FS_PrintingStatus PrintingStatusID PrintingStatusID


us

FK_tbl_FO_tbl_IDOC_Data_Inb dbo.tbl_IDOC_Data DataID_Inbound DataID


ound

FK_tbl_FO_tbl_IDOC_Data_Out dbo.tbl_IDOC_Data DataID_Outbound DataID


bound

FK_tbl_FO_tbl_MD_Material dbo.tbl_MD_Material MATNR MATNR

FK_tbl_FO_tbl_MD_Street dbo.tbl_MD_Street StreetID StreetID

Database Objects Dependent On dbo.tbl_FO Table

Database Object Name Database Object Type

dbo._sp_FO_Finish_Old_20071022 Stored Procedure

dbo.fn_FO_MI_MiCodeID_Get User-Defined Function

dbo.sp_FO_Confirm Stored Procedure

dbo.sp_FO_Details Stored Procedure

dbo.sp_FO_Empty_MixingTank Stored Procedure

dbo.sp_FO_Finish Stored Procedure

dbo.sp_FO_Finish_Old_20080527 Stored Procedure

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 10
FS2 Database Documentation

dbo.sp_FO_Finished Stored Procedure

dbo.sp_FO_FinishedMaterial Stored Procedure

dbo.sp_FO_GetFreeFONr Stored Procedure

dbo.sp_FO_Linking_Add Stored Procedure

dbo.sp_FO_Linking_LinkedList Stored Procedure

dbo.sp_FO_Linking_List Stored Procedure

dbo.sp_FO_Linking_Remove Stored Procedure

dbo.sp_FO_List Stored Procedure

dbo.sp_FO_MI_ADD_List Stored Procedure

dbo.sp_FO_MI_Confirm Stored Procedure

dbo.sp_FO_MI_PROC_PLCCode Stored Procedure

dbo.sp_FO_MI_PROC_SourceEquipment_LIST Stored Procedure

dbo.sp_FO_MI_PROC_SourceEquipment_LIST_Changed Stored Procedure

dbo.sp_FO_PrintingStatus_List Stored Procedure

dbo.sp_FO_Update_ApotheekStatus Stored Procedure

dbo.sp_FO_Update_BulkStatus Stored Procedure

dbo.sp_FO_Update_EquipmentAllocation Stored Procedure

dbo.sp_FO_Update_PackagingStatus Stored Procedure

dbo.sp_FO_Update_PrintingStatus Stored Procedure

dbo.sp_FO_Update_StartDateTime Stored Procedure

dbo.sp_FO_Update_Status Stored Procedure

dbo.sp_FO_Update_Status_Accept Stored Procedure

dbo.sp_FO_Update_Status_Afmelden Stored Procedure

dbo.sp_FO_Update_Status_Cancel Stored Procedure

dbo.sp_FO_Update_Status_EqNogToew Stored Procedure

dbo.sp_FO_Update_Status_Finished Stored Procedure

dbo.sp_FO_Update_Status_Start Stored Procedure

dbo.sp_FO_Update_SubStatus Stored Procedure

dbo.sp_HD_Clean Stored Procedure

dbo.sp_HD_Copy_FO_data_To_HISTORY Stored Procedure

dbo.sp_HD_Delete_FO Stored Procedure

dbo.sp_HD_Delete_Multiple_FO Stored Procedure

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 11
FS2 Database Documentation

dbo.sp_IDOC_CreateOrder_FO Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI Stored Procedure

dbo.sp_IDOC_Send Stored Procedure

dbo.sp_MD_Equipment_Lock Stored Procedure

dbo.sp_MI_PAK Stored Procedure

dbo.sp_MI_PAK_Request Stored Procedure

dbo.sp_RPT_FO_Batch Stored Procedure

dbo.sp_RPT_FO_Comment Stored Procedure

dbo.sp_RPT_FO_Header Stored Procedure

dbo.sp_RPT_FO_Planning Stored Procedure

dbo.sp_RPT_FO_Status Stored Procedure

dbo.sp_RPT_TT_Used Stored Procedure

dbo.sp_Sigma_RPT_FO_Batch Stored Procedure

dbo.sp_Sigma_RPT_FO_Header Stored Procedure

dbo.sv_FO_Linking_List View

dbo.sv_FO_List View

dbo.sv_FO_MI_List View

dbo.sv_IDOC_List_ITEM_Test View

dbo.sv_MD_EquipmentFOUsage View

dbo.sv_PD_Material_NUP View

dbo.sv_PD_MaterialStorage View

dbo.sv_RPT_FO_MI View

dbo.sv_RPT_Mat_Norm_And_Usage_Dates View

dbo.sv_TT_FO_LotCreation View

dbo.sv_TT_FO_LotUsed View

dbo.sv_TT_MaterialLot View

dbo.sv_TT_MaterialLotTransport View

dbo.tr_tbl_FO_UPDATE Trigger

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 12
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Table Details

Table Name Revision #

dbo.tbl_FO_Comment 0

Table Columns

Column Name Identity? Seed Increment Primary Key? Foreign Key?

FOID No N/A N/A Yes FK_tbl_FO_Com


ment_tbl_FO

Comment No N/A N/A No No

Column Name Storage Length Nullable? Precision Scale Computed? Default


Type Value

FOID bigint 8 No N/A N/A No Not entered

Comment varchar 240 Yes N/A N/A No Not entered

Record Details

Maximum Record Length 248 bytes

Check Constraints

Check Constraint Name Check Constraint Value

There are no check constraints on this table.

Indexes

Index Name Clustered?

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 13
FS2 Database Documentation

PK_tbl_FO_Comment Yes

Triggers

Trigger Name

There are no triggers on this table.

Foreign-Key Relationships

Relationship Name Referenced Table Referencing Column Referenced Column

FK_tbl_FO_Comment_tbl_FO dbo.tbl_FO FOID FOID

Database Objects Dependent On dbo.tbl_FO_Comment Table

Database Object Name Database Object Type

dbo._sp_FO_Finish_Old_20071022 Stored Procedure

dbo.sp_FO_Comment Stored Procedure

dbo.sp_FO_Finish Stored Procedure

dbo.sp_FO_Finish_Old_20080527 Stored Procedure

dbo.sp_HD_Copy_FO_data_To_HISTORY Stored Procedure

dbo.sp_RPT_FO_Batch Stored Procedure

dbo.sp_RPT_FO_Comment Stored Procedure

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 14
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Table Details

Table Name Revision #

dbo.tbl_FO_MI 0

Table Columns

Column Name Identity? Seed Increment Primary Key? Foreign Key?

FO_MIID Yes 1 1 Yes No

FOID No N/A N/A No FK_tbl_FO_MI_tb


l_FO

FO_MIStatusID No N/A N/A No FK_tbl_FO_MI_tb


l_FS_FO_MIStatu
s

MicroInstructionID No N/A N/A No FK_tbl_FO_MI_tb


l_MD_MI

ParentFO_MIID No N/A N/A No FK_tbl_FO_MI_tb


l_FO_MI

POSNR No N/A N/A No No

SEGNUM No N/A N/A No No

DataID_Outbound No N/A N/A No FK_tbl_FO_MI_tb


l_IDOC_Data_Ou
tbound

DataID_Inbound No N/A N/A No FK_tbl_FO_MI_tb


l_IDOC_Data_In
bound

Column Name Storage Length Nullable? Precision Scale Computed? Default


Type Value

FO_MIID bigint 8 No N/A N/A No Not entered

FOID bigint 8 Yes N/A N/A No Not entered

FO_MIStatusID tinyint 1 Yes N/A N/A No Not entered

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 15
FS2 Database Documentation

MicroInstructionID tinyint 1 Yes N/A N/A No Not entered

ParentFO_MIID bigint 8 Yes N/A N/A No Not entered

POSNR int 4 Yes N/A N/A No Not entered

SEGNUM int 4 Yes N/A N/A No Not entered

DataID_Outbound bigint 8 Yes N/A N/A No Not entered

DataID_Inbound bigint 8 Yes N/A N/A No Not entered

Record Details

Maximum Record Length 50 bytes

Check Constraints

Check Constraint Name Check Constraint Value

There are no check constraints on this table.

Indexes

Index Name Clustered?

IX_tbl_FO_MI_DataID_Inbound No

IX_tbl_FO_MI_DataID_Outbound No

IX_tbl_FO_MI_FOID No

IX_tbl_FO_MI_MicroInstructionID No

PK_tbl_FO_MI Yes

Triggers

Trigger Name

dbo.tr_tbl_FO_MI_INSERT

Foreign-Key Relationships

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 16
FS2 Database Documentation

Relationship Name Referenced Table Referencing Column Referenced Column

FK_tbl_FO_MI_tbl_FO dbo.tbl_FO FOID FOID

FK_tbl_FO_MI_tbl_FO_MI dbo.tbl_FO_MI ParentFO_MIID FO_MIID

FK_tbl_FO_MI_tbl_FS_FO_MISt dbo.tbl_FS_FO_MIStatus FO_MIStatusID FO_MIStatusID


atus

FK_tbl_FO_MI_tbl_IDOC_Data_ dbo.tbl_IDOC_Data DataID_Inbound DataID


Inbound

FK_tbl_FO_MI_tbl_IDOC_Data_ dbo.tbl_IDOC_Data DataID_Outbound DataID


Outbound

FK_tbl_FO_MI_tbl_MD_MI dbo.tbl_MD_MI MicroInstructionID MicroInstructionID

Database Objects Dependent On dbo.tbl_FO_MI Table

Database Object Name Database Object Type

dbo._sp_FO_Finish_Old_20071022 Stored Procedure

dbo.fn_FO_MI_MiCodeID_Get User-Defined Function

dbo.sp_DELETE_FO Stored Procedure

dbo.sp_DELETE_FO_MI Stored Procedure

dbo.sp_DELETE_IDOC Stored Procedure

dbo.sp_FO_Confirm Stored Procedure

dbo.sp_FO_Empty_MixingTank Stored Procedure

dbo.sp_FO_Finish Stored Procedure

dbo.sp_FO_Finish_Old_20080527 Stored Procedure

dbo.sp_FO_Finished Stored Procedure

dbo.sp_FO_FinishedMaterial Stored Procedure

dbo.sp_FO_Linking_Add Stored Procedure

dbo.sp_FO_Linking_List Stored Procedure

dbo.sp_FO_MI_ADD Stored Procedure

dbo.sp_FO_MI_ADD_CIRC Stored Procedure

dbo.sp_FO_MI_ADD_Equipment Stored Procedure

dbo.sp_FO_MI_ADD_EquipmentSource Stored Procedure

dbo.sp_FO_MI_ADD_EquipmentTransport Stored Procedure

dbo.sp_FO_MI_ADD_INHOUD Stored Procedure

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 17
FS2 Database Documentation

dbo.sp_FO_MI_ADD_LOSSEN Stored Procedure

dbo.sp_FO_MI_ADD_Material Stored Procedure

dbo.sp_FO_MI_ADD_MOTOR Stored Procedure

dbo.sp_FO_MI_ADD_REGISTR Stored Procedure

dbo.sp_FO_MI_ADD_SMKORR Stored Procedure

dbo.sp_FO_MI_ADD_STAPEL Stored Procedure

dbo.sp_FO_MI_ADD_TEMP Stored Procedure

dbo.sp_FO_MI_ADD_Text Stored Procedure

dbo.sp_FO_MI_Confirm Stored Procedure

dbo.sp_FO_MI_Confirm_VULHOP_Tijdelijk_OLD Stored Procedure

dbo.sp_FO_MI_FinishedMaterial Stored Procedure

dbo.sp_FO_MI_List Stored Procedure

dbo.sp_FO_MI_List_Old Stored Procedure

dbo.sp_FO_MI_PROC_CancelFS Stored Procedure

dbo.sp_FO_MI_PROC_ErrorFS Stored Procedure

dbo.sp_FO_MI_PROC_ErrorPCS Stored Procedure

dbo.sp_FO_MI_PROC_Finished Stored Procedure

dbo.sp_FO_MI_PROC_FinishedMaterial Stored Procedure

dbo.sp_FO_MI_PROC_FinishedMaterialNew Stored Procedure

dbo.sp_FO_MI_PROC_PLCCode Stored Procedure

dbo.sp_FO_MI_PROC_ReRun Stored Procedure

dbo.sp_FO_MI_PROC_Reset Stored Procedure

dbo.sp_FO_MI_PROC_ResetFS Stored Procedure

dbo.sp_FO_MI_PROC_SourceEquipment Stored Procedure

dbo.sp_FO_MI_PROC_SourceEquipment_LIST Stored Procedure

dbo.sp_FO_MI_PROC_SourceEquipment_LIST_Changed Stored Procedure

dbo.sp_FO_MI_PROC_StartFS Stored Procedure

dbo.sp_FO_MI_PROC_StartPCS Stored Procedure

dbo.sp_FO_MI_PROC_StopFS Stored Procedure

dbo.sp_FO_MI_PROC_StopPCS Stored Procedure

dbo.sp_FO_Update_EquipmentAllocation Stored Procedure

dbo.sp_FO_Update_Status Stored Procedure

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 18
FS2 Database Documentation

dbo.sp_FO_Update_Status_Finished Stored Procedure

dbo.sp_FO_Update_Status_Start Stored Procedure

dbo.sp_HD_Copy_FO_data_To_HISTORY Stored Procedure

dbo.sp_HD_Move_Log_data_To_HISTORY Stored Procedure

dbo.sp_IDOC_CreateOrder_Check Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI_BEREKEN Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI_Equipment Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI_EquipmentSource Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI_EquipmentTransport Stored Procedure

dbo.sp_IDOC_CreateOrder_FO_MI_INHOUD Stored Procedure

dbo.sp_IDOC_Data_Update Stored Procedure

dbo.sp_IDOC_Send Stored Procedure

dbo.sp_MD_MiCodeEquipment Stored Procedure

dbo.sp_MI_BEREKEN Stored Procedure

dbo.sp_MI_PAK Stored Procedure

dbo.sp_MI_PAK_Request Stored Procedure

dbo.sp_MI_REGISTR Stored Procedure

dbo.sp_MI_RESET Stored Procedure

dbo.sp_MI_VARVOEG_List Stored Procedure

dbo.sp_MI_VRIJ Stored Procedure

dbo.sp_MI_VRIJ_Request Stored Procedure

dbo.sp_RPT_FO_Batch Stored Procedure

dbo.sp_RPT_FO_MaterialLot Stored Procedure

dbo.sp_RPT_TT_Used Stored Procedure

dbo.sv_FO_EquipmentLocked View

dbo.sv_FO_Linking_List View

dbo.sv_FO_MI View

dbo.sv_FO_MI_List_BEREKEN View

dbo.sv_FO_MI_List_CIRC View

dbo.sv_FO_MI_List_Equipment View

dbo.sv_FO_MI_List_EquipmentSource View

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 19
FS2 Database Documentation

dbo.sv_FO_MI_List_EquipmentTransport View

dbo.sv_FO_MI_List_INHOUD View

dbo.sv_FO_MI_List_LOSSEN View

dbo.sv_FO_MI_List_Material View

dbo.sv_FO_MI_List_MOTOR View

dbo.sv_FO_MI_List_REGISTR View

dbo.sv_FO_MI_List_SMAFDEK View

dbo.sv_FO_MI_List_SMKORR View

dbo.sv_FO_MI_List_SMNUP View

dbo.sv_FO_MI_List_STAPEL View

dbo.sv_FO_MI_List_TEMP View

dbo.sv_FO_MI_List_Text View

dbo.sv_FO_MI_Validate View

dbo.sv_FO_MI_Validate_BEREKEN View

dbo.sv_FO_MI_Validate_CIRC View

dbo.sv_FO_MI_Validate_Equipment View

dbo.sv_FO_MI_Validate_EquipmentSource View

dbo.sv_FO_MI_Validate_EquipmentTransport View

dbo.sv_FO_MI_Validate_INHOUD View

dbo.sv_FO_MI_Validate_LOSSEN View

dbo.sv_FO_MI_Validate_Material View

dbo.sv_FO_MI_Validate_MOTOR View

dbo.sv_FO_MI_Validate_REGISTR View

dbo.sv_FO_MI_Validate_SMAFDEK View

dbo.sv_FO_MI_Validate_SMKORR View

dbo.sv_FO_MI_Validate_SMNUP View

dbo.sv_FO_MI_Validate_STAPEL View

dbo.sv_FO_MI_Validate_TEMP View

dbo.sv_FO_MI_Validate_Text View

dbo.sv_IDOC_List_COMP View

dbo.sv_IDOC_List_COMP_Test View

dbo.sv_PD_Material_NUP View

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 20
FS2 Database Documentation

dbo.sv_PD_Material_STORT View

dbo.sv_PD_Material_TRANS View

dbo.sv_PD_MaterialFoMiSources View

dbo.sv_PD_MaterialFoUsed View

dbo.sv_RPT_FO_MI_BEREKEN View

dbo.sv_RPT_FO_MI_CIRC View

dbo.sv_RPT_FO_MI_Equipment View

dbo.sv_RPT_FO_MI_EquipmentSource View

dbo.sv_RPT_FO_MI_EquipmentTransport View

dbo.sv_RPT_FO_MI_INHOUD View

dbo.sv_RPT_FO_MI_LOSSEN View

dbo.sv_RPT_FO_MI_Material View

dbo.sv_RPT_FO_MI_MOTOR View

dbo.sv_RPT_FO_MI_REGISTR View

dbo.sv_RPT_FO_MI_SMAFDEK View

dbo.sv_RPT_FO_MI_SMKORR View

dbo.sv_RPT_FO_MI_SMNUP View

dbo.sv_RPT_FO_MI_STAPEL View

dbo.sv_RPT_FO_MI_TEMP View

dbo.sv_RPT_FO_MI_Text View

dbo.sv_RPT_Mat_Norm_And_Usage_Dates View

dbo.sv_RPT_PD_MaterialTransport View

dbo.sv_TT_FO_LotCreation View

dbo.sv_TT_FO_LotUsed View

dbo.sv_TT_MaterialLotTransport View

dbo.tr_tbl_FO_MI_INSERT Trigger

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 21
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

View Name

dbo._rro_sv_IDOC_Material

View Columns and Aliases

Column Name or Alias Storage Length Nullable? Precision Scale Computed? Default
Type Value

MATNR bigint 8 Yes N/A N/A No Not entered

Material varchar 1000 Yes N/A N/A No Not entered

Unit varchar 3 Yes N/A N/A No Not entered

MaterialType nvarchar 100 Yes N/A N/A No Not entered

CPR varchar 1000 Yes N/A N/A No Not entered

WMS varchar 1000 Yes N/A N/A No Not entered

Health varchar 1000 Yes N/A N/A No Not entered

Flammability varchar 1000 Yes N/A N/A No Not entered

Reactivity varchar 1000 Yes N/A N/A No Not entered

MeansOfProtectionID varchar 1000 Yes N/A N/A No Not entered

View Structured Query Language (SQL) Source Code

--
|================================================================================
======
--| Name : sv_IDOC_Material
--| Functiongroup : IDOC
--| Project : 310200 SigmaKalon
--| Development tool : Microsoft SQL Server Management Studio 2005
--
|================================================================================
======
--| Description : Deze view wordt gebruikt voor het presenteren van materiaal.
--|
--
|================================================================================
======
--| Date | Version | Name | Changed

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 22
FS2 Database Documentation

--|------------+---------+---------------+-----------------------------------------------
--| 25-04-2006 | 0.2 | G.J. Luimes | Not all materials have EH&S information.
--|------------+---------+---------------+-----------------------------------------------
--| 22-03-2006 | 0.1 | G.J. Luimes | Initial version.
--|------------+---------+---------------+-----------------------------------------------

CREATE VIEW [dbo].[sv_IDOC_Material]


AS
SELECT CONVERT(bigint, [dbo].[fn_IDOC_GetField] ([Data_MARA].[SDATA], [Segment_MARA].[SEGNAM], 'MATNR', 1)) AS
[MATNR],
[dbo].[fn_IDOC_GetField] ([Data_MAKT].[SDATA], [Segment_MAKT].[SEGNAM], 'MAKTX', 1) AS [Material],
CONVERT(varchar(3), NULL) AS [Unit],
CONVERT(nvarchar(100), NULL) AS [MaterialType],
[dbo].[fn_IDOC_GetField] ([Data_CPR].[SDATA], [Segment_CPR].[SEGNAM], 'CHAR_VALUE', 1) AS [CPR],
[dbo].[fn_IDOC_GetField] ([Data_WMS].[SDATA], [Segment_WMS].[SEGNAM], 'CHAR_VALUE', 1) AS [WMS],
[dbo].[fn_IDOC_GetField] ([Data_HEALTH].[SDATA], [Segment_HEALTH].[SEGNAM], 'CHAR_VALUE', 1) AS [Health],
[dbo].[fn_IDOC_GetField] ([Data_FLAMM].[SDATA], [Segment_FLAMM].[SEGNAM], 'CHAR_VALUE', 1) AS [Flammability],
[dbo].[fn_IDOC_GetField] ([Data_REACT].[SDATA], [Segment_REACT].[SEGNAM], 'CHAR_VALUE', 1) AS [Reactivity],
[dbo].[fn_IDOC_GetField] ([Data_PMEANS].[SDATA], [Segment_PMEANS].[SEGNAM], 'CHAR_VALUE', 1) AS
[MeansOfProtectionID]
FROM [dbo].[tbl_IDOC_Control] AS [Control]
INNER JOIN [dbo].[tbl_FS_IDocType] AS [Type]
ON [Control].[IDocTypeID] = [Type].[IDocTypeID] AND
[Type].[IDOCTYP] = 'ZMATDG01'
INNER JOIN [dbo].[tbl_IDOC_Data] AS [Data_MARA]
ON [Control].[ControlID] = [Data_MARA].[ControlID]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_MARA]
ON [Data_MARA].[IDocSegmentID] = [Segment_MARA].[IDocSegmentID] AND
[Segment_MARA].[SEGNAM] = 'E2MARAM004'
INNER JOIN [dbo].[tbl_IDOC_Data] AS [Data_MAKT]
ON [Control].[ControlID] = [Data_MAKT].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_MAKT].[PSGNUM]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_MAKT]
ON [Data_MAKT].[IDocSegmentID] = [Segment_MAKT].[IDocSegmentID] AND
[Segment_MAKT].[SEGNAM] = 'E2MAKTM001'
INNER JOIN [dbo].[tbl_IDOC_Data] AS [Data_MARC]
ON [Control].[ControlID] = [Data_MARC].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_MARC].[PSGNUM]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_MARC]
ON [Data_MARC].[IDocSegmentID] = [Segment_MARC].[IDocSegmentID] AND
[Segment_MARC].[SEGNAM] = 'E2MARCM003'
LEFT OUTER JOIN ([dbo].[tbl_IDOC_Data] AS [Data_CPR]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_CPR]
ON [Data_CPR].[IDocSegmentID] = [Segment_CPR].[IDocSegmentID] AND
[Segment_CPR].[SEGNAM] = 'Z2BP1077PR000' AND
[dbo].[fn_IDOC_GetField] ([Data_CPR].[SDATA], [Segment_CPR].[SEGNAM], 'NAME_CHAR', 1) =
'ZSIG_EHS_1021_002_CPR')
ON [Control].[ControlID] = [Data_CPR].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_CPR].[PSGNUM]
LEFT OUTER JOIN ([dbo].[tbl_IDOC_Data] AS [Data_WMS]

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 23
FS2 Database Documentation

INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_WMS]


ON [Data_WMS].[IDocSegmentID] = [Segment_WMS].[IDocSegmentID] AND
[Segment_WMS].[SEGNAM] = 'Z2BP1077PR000' AND
[dbo].[fn_IDOC_GetField] ([Data_WMS].[SDATA], [Segment_WMS].[SEGNAM], 'NAME_CHAR', 1) =
'ZSIG_EHS_1021_002_WMS')
ON [Control].[ControlID] = [Data_WMS].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_WMS].[PSGNUM]
LEFT OUTER JOIN ([dbo].[tbl_IDOC_Data] AS [Data_HEALTH]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_HEALTH]
ON [Data_HEALTH].[IDocSegmentID] = [Segment_HEALTH].[IDocSegmentID] AND
[Segment_HEALTH].[SEGNAM] = 'Z2BP1077PR000' AND
[dbo].[fn_IDOC_GetField] ([Data_HEALTH].[SDATA], [Segment_HEALTH].[SEGNAM], 'NAME_CHAR', 1) =
'ZSIG_EHS_1016_002_HEALTH')
ON [Control].[ControlID] = [Data_HEALTH].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_HEALTH].[PSGNUM]
LEFT OUTER JOIN ([dbo].[tbl_IDOC_Data] AS [Data_FLAMM]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_FLAMM]
ON [Data_FLAMM].[IDocSegmentID] = [Segment_FLAMM].[IDocSegmentID] AND
[Segment_FLAMM].[SEGNAM] = 'Z2BP1077PR000' AND
[dbo].[fn_IDOC_GetField] ([Data_FLAMM].[SDATA], [Segment_FLAMM].[SEGNAM], 'NAME_CHAR', 1) =
'ZSIG_EHS_1016_002_FLAMM')
ON [Control].[ControlID] = [Data_FLAMM].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_FLAMM].[PSGNUM]
LEFT OUTER JOIN ([dbo].[tbl_IDOC_Data] AS [Data_REACT]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_REACT]
ON [Data_REACT].[IDocSegmentID] = [Segment_REACT].[IDocSegmentID] AND
[Segment_REACT].[SEGNAM] = 'Z2BP1077PR000' AND
[dbo].[fn_IDOC_GetField] ([Data_REACT].[SDATA], [Segment_REACT].[SEGNAM], 'NAME_CHAR', 1) =
'ZSIG_EHS_1016_002_REACT')
ON [Control].[ControlID] = [Data_REACT].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_REACT].[PSGNUM]
LEFT OUTER JOIN ([dbo].[tbl_IDOC_Data] AS [Data_PMEANS]
INNER JOIN [dbo].[tbl_FS_IDocSegment] AS [Segment_PMEANS]
ON [Data_PMEANS].[IDocSegmentID] = [Segment_PMEANS].[IDocSegmentID] AND
[Segment_PMEANS].[SEGNAM] = 'Z2BP1077PR000' AND
[dbo].[fn_IDOC_GetField] ([Data_PMEANS].[SDATA], [Segment_PMEANS].[SEGNAM], 'NAME_CHAR', 1) =
'ZSIG_EHS_1016_002_PMEANS')
ON [Control].[ControlID] = [Data_PMEANS].[ControlID] AND
[Data_MARA].[SEGNUM] = [Data_PMEANS].[PSGNUM]
WHERE [Control].[IDocStatusID] = 4 AND
[dbo].[fn_IDOC_GetField] ([Data_MAKT].[SDATA], [Segment_MAKT].[SEGNAM], 'SPRAS', 1) = 'N' AND
[dbo].[fn_IDOC_GetField] ([Data_MARC].[SDATA], [Segment_MARC].[SEGNAM], 'WERKS', 1) = 'NL09'

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 24
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

View Name

dbo.sv_FO_EquipmentLocked

View Columns and Aliases

Column Name or Alias Storage Length Nullable? Precision Scale Computed? Default
Type Value

FOID bigint 8 Yes N/A N/A No Not entered

View Structured Query Language (SQL) Source Code

--
|================================================================================
=======
--|Name : sv_FO_EquipmentLocked
--|Functiongroup : Fabricage Orders (FO)
--|Project : 310200 SigmaKalon
--|Programmeer omgeving : Microsoft SQL Server Management Studio 2005
--
|================================================================================
=======
--|Description : Geeft een overzicht van de fabricage orders waarin equipment is gelocked.
--|
--
|================================================================================
=======
--| Date | Version| Name | Changed
--|------------+--------+---------------+-------------------------------------------------
--| 29-03-2006 | 0.2 | R.A. de Roon | Equipment bepalen via de resource
--|------------+--------+-----------------------------------------------------------------
--| 12-01-2006 | 0.1 | R.A. de Roon | Initial version
--|------------+--------+-----------------------------------------------------------------
CREATE VIEW [dbo].[sv_FO_EquipmentLocked]
AS

SELECT DISTINCT MI.FOID


FROM tbl_FO_MI AS MI
INNER JOIN (SELECT * FROM [dbo].[tbl_FO_MI_Equipment]
UNION ALL
SELECT * FROM [dbo].[tbl_FO_MI_EquipmentSource]) AS [Equipment]
ON [MI].[FO_MIID] = [Equipment].[FO_MIID]

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 25
FS2 Database Documentation

INNER JOIN [dbo].[tbl_FO_Resource] AS [Resource]


ON [Equipment].[ResourceID] = [Resource].[ResourceID] AND
[Resource].[FOID] = [MI].[FOID]
INNER JOIN [dbo].[tbl_MD_Equipment] as [MD_Equipment]
ON [Resource].[EquipmentID] = [MD_Equipment].[EquipmentID]
WHERE [MD_Equipment].[EquipmentStatusID]=1

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 26
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

View Name

dbo.sv_FO_Linking_LinkedList

View Columns and Aliases

Column Name or Alias Storage Length Nullable? Precision Scale Computed? Default
Type Value

ParentFoID bigint 8 Yes N/A N/A No Not entered

FOID bigint 8 No N/A N/A No Not entered

View Structured Query Language (SQL) Source Code

--
+===============================================================================
========
--|Name : [sv_FO_Linking_LinkedList]
--|Functiongroup : Fabricage Orders (FO)
--|Project : 310200 SigmaKalon
--|Programmeer omgeving : Microsoft SQL Server Management Studio 2005
--
+===============================================================================
========
--|Description : Deze view geeft alle orders welke gekoppeld zijn.
--|
--
+===============================================================================
========
--| Date | Version| Name | Changed
--+------------+--------+---------------+-------------------------------------------------
--| 09-12-2005 | 0.1 | R.A. de Roon | Initial version
--+------------+--------+-----------------------------------------------------------------

CREATE VIEW [dbo].[sv_FO_Linking_LinkedList]


AS
SELECT [ParentFoID],
[FOID]
FROM [dbo].[tbl_FO]
WHERE ([ParentFoID] IS NOT NULL)

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 27
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Stored Procedure Name

dbo._sp_FO_Finish_Old_20071022

Stored Procedure Parameters

Parameter Name Direction Storage Type Length Precision Scale

@FOID Input bigint 8 N/A N/A

Stored Procedure Structured Query Language (SQL) Source Code

--
|================================================================================
======
--| Name : [sp_FO_Finish]
--| Functiongroup : FO
--| Project : 310200 SigmaKalon
--| Development tool : Microsoft SQL Server Management Studio 2005
--
|================================================================================
======
--| Description : Informatie opvragen welke bij de dialoog voor
--| afmelden van de order wordt gebruikt.
--|
--| Parameters : @FOID De ID van de FO regel.
--|
--
|================================================================================
======
--| Date | Version | Name | Changed
--|------------+---------+---------------+-----------------------------------------------
--| 22-03-2007 | 0.2 | R.A. de Roon | EMB quant op andere manier bepalen zodat
--| | | | altijd de grootste (MAX) wordt genomen.
--|------------+---------+---------------+-----------------------------------------------
--| 11-01-2007 | 0.1 | R.A. de Roon | Initial version.
--|------------+---------+---------------+-----------------------------------------------

CREATE PROCEDURE [dbo].[_sp_FO_Finish_Old_20071022] (@FOID AS bigint)


AS
DECLARE @ReturnCode AS smallint

DECLARE @NUP_FO_MIID as bigint

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 28
FS2 Database Documentation

DECLARE @NUP_Quant as Float


DECLARE @NUP_RealQuant as Float
DECLARE @NUP_Unit as varchar(3)

DECLARE @EMB_FO_MIID as bigint


DECLARE @EMB_Quant as Float
DECLARE @EMB_RealQuant as Float
DECLARE @EMB_Unit as varchar(3)
DECLARE @EMB_Tolerance as float

DECLARE @OutOffTolerance as tinyint


DECLARE @Comment as varchar(1000)
DECLARE @FO_Comment as varchar(1000)

DECLARE @StorageQuantity as float

SET NOCOUNT ON
SET @Comment = 'sp_FO_Finish (FOID: ' + CONVERT(varchar, @FOID) + ').'

BEGIN TRY

DECLARE @TextID as bigint


DECLARE @FO_MIID as bigint
DECLARE @Value as varchar(20)

-- Tekst ID van de Register


SELECT @TextID = [Text].[TEXTID]
FROM [dbo].[tbl_FS_Text] AS [Text]
WHERE ([Text].[Text] LIKE ('%AFGELEVERDE AANTAL STUKS%'))

-- Resultaat van de Register 'AFGELEVERDE AANTAL STUKS' ophalen.


SELECT @FO_MIID = [FO_MI].[FO_MIID],
@Value = [FO_MI_REGISTR].[Result]
FROM [dbo].[tbl_FO_MI] AS [FO_MI]
INNER JOIN [dbo].[tbl_FO_MI_Text] AS [FO_MI_Text]
ON [FO_MI].[FO_MIID] = [FO_MI_Text].[FO_MIID]
INNER JOIN [dbo].[tbl_FO_MI_REGISTR] AS [FO_MI_REGISTR]
ON [FO_MI].[FO_MIID]=[FO_MI_REGISTR].[FO_MIID]
WHERE ([FO_MI_Text].[TEXTID] = @TextID) AND
([FO_MI].[FOID] = @FOID)

IF (@FO_MIID IS NOT NULL) AND


(ISNUMERIC(@Value)=1) AND
(@Value IS NOT NULL)
BEGIN
SET @EMB_RealQuant = CAST( @Value as real)
END

PRINT @Comment

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 29
FS2 Database Documentation

-- Ophalen EMB_Tolerance
SELECT @EMB_Tolerance = [Value]
FROM [dbo].[tbl_FS_Parameters]
WHERE [Parameter] = 'EMB_Tolerance'

PRINT 'EMB_Tolerance : ' + STR(@EMB_Tolerance,10,2)

-- Ophalen Comment van de order.


SELECT @FO_Comment = [Comment]
FROM [dbo].[tbl_FO_Comment]
WHERE [FOID] = @FOID

IF @FO_Comment IS NULL
SET @FO_Comment = ''

PRINT 'FO_Comment : ' + @FO_Comment

-- Bepaal FO_MiID voor NUP


SELECT @NUP_FO_MIID = [FO_MI].[FO_MIID]
FROM [dbo].[tbl_FO_MI] AS [FO_MI]
INNER JOIN [dbo].[tbl_MD_MI] AS [MD_MI]
ON [FO_MI].[MicroInstructionID] = [MD_MI].[MicroinstructionID]
WHERE [MD_MI].[Microinstruction] = 'NUP' AND
[FO_MI].[FOID] = @FOID

PRINT 'NUP_FO_MIID : ' + STR(@NUP_FO_MIID)

-- -- Bepaal FO_MiID voor EMB


-- SELECT @EMB_FO_MIID = [FO_MI].[FO_MIID]
-- FROM [dbo].[tbl_FO_MI] AS [FO_MI]
-- INNER JOIN [dbo].[tbl_MD_MI] AS [MD_MI]
-- ON [FO_MI].[MicroInstructionID] = [MD_MI].[MicroinstructionID]
-- WHERE [MD_MI].[Microinstruction] = 'EMB' AND
-- [FO_MI].[FOID] = @FOID
-- PRINT 'EMB_FO_MIID : ' + STR(@EMB_FO_MIID)

-- Ophalen norm hoeveelheid en werkelijke hoeveelheid NUP


SELECT
@NUP_Quant = [FO_MI_Material].[Quant],
@NUP_Unit = [MD_Unit].[Unit]
FROM [dbo].[tbl_FO_MI_Material] as [FO_MI_Material]
INNER JOIN [dbo].[tbl_MD_Material] as [MD_Material]
ON [FO_MI_Material].[MatNr] = [MD_Material].[MatNr]
LEFT OUTER JOIN [dbo].[tbl_MD_Unit] as [MD_Unit]
ON [MD_Material].[UnitID] = [MD_Unit].[UnitID]
WHERE [FO_MI_Material].[FO_MIID] = @NUP_FO_MIID

-- Zetten werkelijke hoeveelheid NUP, als NORM hoeveelheid


SET @NUP_RealQuant = @NUP_Quant

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 30
FS2 Database Documentation

-- -- Ophalen norm hoeveelheid en werkelijke hoeveelheid EMB


-- SELECT @EMB_Quant = [FO_MI_Material].[Quant],
---- @EMB_RealQuant = [FO_MI_Material].[RealQuant],
-- @EMB_Unit = [MD_Unit].[Unit],
-- -- Het tollerantie veld invullen
-- -- Hij is buiten de tollerantie wanneer er meer als EMB_Tolerance afwijkt.
-- @OutOffTolerance =
-- CASE WHEN
-- [FO_MI_Material].[Quant] > 0 THEN
-- CASE WHEN
-- ABS(((100 / [FO_MI_Material].[Quant]) * [FO_MI_Material].[RealQuant]) - 100) > @EMB_Tolerance THEN
-- 1
-- ELSE
-- 0
-- END
-- ELSE
-- 1
-- END
-- FROM [dbo].[tbl_FO_MI_Material] as [FO_MI_Material]
-- INNER JOIN [dbo].[tbl_MD_Material] as [MD_Material]
-- ON [FO_MI_Material].[MatNr] = [MD_Material].[MatNr]
-- LEFT OUTER JOIN [dbo].[tbl_MD_Unit] as [MD_Unit]
-- ON [MD_Material].[UnitID] = [MD_Unit].[UnitID]
-- WHERE [FO_MI_Material].[FO_MIID] = @EMB_FO_MIID

SELECT @EMB_Quant = MAX([FO_MI_Material].[Quant]),


@EMB_Unit = [MD_Unit].[Unit],
-- Het tollerantie veld invullen
-- Hij is buiten de tollerantie wanneer er meer als EMB_Tolerance afwijkt.
@OutOffTolerance = CASE WHEN
MAX([FO_MI_Material].[Quant]) > 0 THEN
CASE WHEN
ABS(((100 / MAX([FO_MI_Material].[Quant])) * MAX([FO_MI_Material].[RealQuant])) - 100) >
@EMB_Tolerance THEN
1
ELSE
0
END
ELSE
1
END
FROM [dbo].[tbl_FO_MI_Material] as [FO_MI_Material]
INNER JOIN [dbo].[tbl_MD_Material] as [MD_Material]
ON [FO_MI_Material].[MatNr] = [MD_Material].[MatNr]
LEFT OUTER JOIN [dbo].[tbl_MD_Unit] as [MD_Unit]
ON [MD_Material].[UnitID] = [MD_Unit].[UnitID]

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 31
FS2 Database Documentation

INNER JOIN [dbo].[tbl_FO_MI] AS [FO_MI]


ON [FO_MI_Material].[FO_MIID] = [FO_MI].[FO_MIID]
INNER JOIN [dbo].[tbl_MD_MI] AS [MD_MI]
ON [FO_MI].[MicroInstructionID] = [MD_MI].[MicroinstructionID]
WHERE [MD_MI].[Microinstruction] = 'EMB' AND
[FO_MI].[FOID] = @FOID
GROUP BY [MD_Unit].[Unit]

-- Ophalen gewicht in storage


DECLARE @FoType as varchar(20)
DECLARE @Storage as varchar(20)
DECLARE @EquipmentID as int
DECLARE @Number as int
DECLARE @MatNr as int

-- Bepaal de bron (SourceEquipment) en de FOType en het aantal van deze order.

-- SELECT @Number = COUNT([FO_MI].[FOID]),


-- @FoType = [FoType].[FoType],
-- @EquipmentID = MIN([Resource].[EquipmentID]),
-- @MatNr = [FO].[MATNR]
-- FROM [dbo].[tbl_FO_MI] AS [FO_MI]
-- INNER JOIN [dbo].[tbl_FO_MI_Equipment] as [FO_MI_Equipment]
-- ON [FO_MI].[FO_MIID] = [FO_MI_Equipment].[FO_MIID]
-- INNER JOIN [dbo].[tbl_FO_Resource] AS [Resource]
-- ON [FO_MI_Equipment].[ResourceID] = [Resource].[ResourceID] AND
-- [FO_MI].[FOID] = [Resource].[FOID]
-- INNER JOIN [dbo].[tbl_MD_MI] AS [MD_MI]
-- ON [FO_MI].[MicroInstructionID] = [MD_MI].[MicroInstructionID]
-- INNER JOIN [dbo].[tbl_FO] AS [FO]
-- ON [FO_MI].[FOID] = [FO].[FOID]
-- INNER JOIN [dbo].[tbl_FS_FOType] AS [FoType]
-- ON ([FO].[FoTypeID] = [FoType].[FoTypeID])
-- WHERE ([FoType].[FoType] = 'VO') AND
-- ([Resource].[EquipmentID] IS NOT NULL) AND
-- ([FO_MI].[FOID] = @FOID)
-- GROUP BY [FO_MI].[FOID],
-- [FoType].[FoType],
-- [MD_MI].[MicroInstruction],
-- [FO].[MATNR]

SET @Number = 1
SELECT @FoType = [FoType].[FoType],
@EquipmentID = [Resource].[EquipmentID],
@MatNr = [FO].[MATNR]
FROM [dbo].[tbl_FO_MI] AS [FO_MI]
INNER JOIN [dbo].[tbl_FO_MI_Equipment] as [FO_MI_Equipment]
ON [FO_MI].[FO_MIID] = [FO_MI_Equipment].[FO_MIID]
INNER JOIN [dbo].[tbl_FO_Resource] AS [Resource]
ON [FO_MI_Equipment].[ResourceID] = [Resource].[ResourceID] AND

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 32
FS2 Database Documentation

[FO_MI].[FOID] = [Resource].[FOID]
INNER JOIN [dbo].[tbl_MD_MI] AS [MD_MI]
ON [FO_MI].[MicroInstructionID] = [MD_MI].[MicroInstructionID]
INNER JOIN [dbo].[tbl_FO] AS [FO]
ON [FO_MI].[FOID] = [FO].[FOID]
INNER JOIN [dbo].[tbl_FS_FOType] AS [FoType]
ON ([FO].[FoTypeID] = [FoType].[FoTypeID])
WHERE ([FoType].[FoType] = 'VO') AND
([FO_MI].[FOID] = @FOID) AND
([MD_MI].[Microinstruction] = 'NUP')
Print 'EquipmentID: ' + STR(@EquipmentID) +
'MatNr: ' + STR(@MatNR)

-- Bepaal of het een VO is en er een source equipment is.


IF (ISNULL(@FOType,'') = 'VO') AND (@Number = 1)
BEGIN

SELECT DISTINCT @Storage = [Storage].[Storage]


FROM [dbo].[tbl_MD_Storage] AS [Storage]
INNER JOIN [dbo].[tbl_MD_Equipment] as [Equipment]
ON [Storage].[StorageID] = [Equipment].[StorageId]
WHERE [Equipment].[EquipmentID] = @EquipmentID

Print 'Storage: ' + @Storage + ' MatNr: ' + LTRIM(STR(@MatNr))

SELECT @StorageQuantity = ISNULL([Quant],0.0)


FROM [dbo].[sv_PD_MaterialStorage]
WHERE [Storage] = @Storage

END

END TRY
BEGIN CATCH

Print 'Error ' + @Comment

-- Sla de error op.

EXECUTE [dbo].[sp_LOG_Error] @Comment

-- Resultaat teruggeven.

SET @ReturnCode = -1

END CATCH

SELECT ISNULL(@ReturnCode,0) AS ReturnCode,


@NUP_Quant AS NUP_Quant,
@NUP_RealQuant AS NUP_RealQuant,
@NUP_Unit AS NUP_Unit,

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 33
FS2 Database Documentation

@EMB_Quant AS EMB_Quant,
@EMB_RealQuant AS EMB_RealQuant,
@EMB_Unit AS EMB_Unit,
@OutOffTolerance AS OutOffTolerance,
@FO_Comment AS FO_Comment,
@StorageQuantity AS StorageQuantity

RETURN ISNULL(@ReturnCode, 0)

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 34
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Stored Procedure Name

dbo._sp_FO_MI_PROC_Equipment_List_Old_20071022

Stored Procedure Parameters

Parameter Name Direction Storage Type Length Precision Scale

@FO_MIID Input bigint 8 N/A N/A

@MatNr Input int 4 N/A N/A

Stored Procedure Structured Query Language (SQL) Source Code

/*+==============================================================================
=========
--|Name : [sp_FO_MI_PROC_Equipment_List]
--|Functiongroup : Fabricage Orders (FO)
--|Project : 310200 SigmaKalon
--|Programmeer omgeving : Microsoft SQL Server Management Studio 2005
--
+===============================================================================
========
Doel:
geeft een lijst met mogenlijke bronnen gebaseerd op het meegegeven een matnr
--|
--|Parameters : @FO_MIId = MicroinstructieID.
--| : @MatNr = Material number voor de beperking.
--|
--|Returncode : Geen
--
+===============================================================================
========
--| Date | Version| Name | Changed
--+------------+--------+---------------+-------------------------------------------------
--| 16-05-2006 | 0.5 | MJ van Kampen |
Harde MicroInstructionID 64 vervangen voor LOSSEN
Straat halen uit MiCode tabel NIET van Equipment.
Equipment is een alias en heeft geen harde straat, straatid kan verschillend zijn, er
wordt maar 1 id overgenomen. Eigenlijk moet dit helemaal niet (equipment.streetid = null)

--+------------+--------+---------------+-------------------------------------------------
--| 10-04-2006 | 0.4 | R.A. de Roon | Het restricted Material nemen van de storage.
--+------------+--------+-----------------------------------------------------------------

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 35
FS2 Database Documentation

--| 28-03-2006 | 0.3 | R.A. de Roon | Bij Matnr ook Street meegeven.
--+------------+--------+-----------------------------------------------------------------
--| 28-03-2006 | 0.2 | R.A. de Roon | Matnummer als parameter meenemen.
--+------------+--------+-----------------------------------------------------------------
--| 31-01-2006 | 0.1 | R.A. de Roon | Initial version
--+------------+--------+-----------------------------------------------------------------
*/

CREATE PROCEDURE [dbo].[_sp_FO_MI_PROC_Equipment_List_Old_20071022]


@FO_MIID as bigint = NULL,
@MatNr as int = NULL
AS

SET NOCOUNT ON

PRINT @MatNr
IF @Matnr IS NOT NULL
BEGIN
SELECT
[Equipment].[EquipmentID]
,[Equipment].[Equipment]
,[Street].[Street]
FROM
[dbo].[tbl_MD_MICode] AS [MICode]
INNER JOIN [dbo].[tbl_MD_MI] AS [MI]
ON [MiCode].[MicroInstructionID] = [MI].[MicroInstructionID]
INNER JOIN [dbo].[tbl_MD_Equipment] AS [Equipment]
ON [MICode].[DestinationEquipmentID] = [Equipment].[EquipmentID]
AND [MI].[MicroInstruction] = 'LOSSEN'
INNER JOIN [dbo].[tbl_MD_Storage] AS [Storage]
ON [Equipment].[StorageID] = [Storage].[StorageID]
INNER JOIN [dbo].[tbl_MD_Street] AS [Street]
ON [Street].[StreetID] = [MICode].[StreetID]
WHERE
[Storage].[RestrictedMatNr] = @MatNr
END
ELSE
BEGIN
SELECT [EquipmentID],
[Equipment]
FROM [dbo].[tbl_MD_Equipment]
END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 36
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

User-Defined Function Name

dbo.fn_FO_MI_MiCodeID_Get

User-Defined Function Parameters

Parameter Name Direction Storage Type Length Precision Scale

@FO_MiID Input bigint 8 N/A N/A

User-Defined Function Structured Query Language (SQL) Source Code

-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fn_FO_MI_MiCodeID_Get]
(
@FO_MiID BIGINT
)
RETURNS INT
AS
BEGIN
-- Declare the return variable here
DECLARE @MiCodeID INT

-- Add the T-SQL statements to compute the return value here


SELECT @MiCodeID=MiCode.MiCodeID
FROM tbl_MD_MiCode AS MiCode
INNER JOIN
(SELECT [FO_MI].[MicroInstructionID],
FO_MI.[FO_MiID],
[MiEqDst].[EquipmentID] AS DestinationEquipmentID,
[MiEqTra].[EquipmentID] AS TransportEquipmentID,
[MiEqSrc].[EquipmentID] AS SourceEquipmentID,
[FO].[StreetID]
FROM tbl_FO_MI AS [FO_MI]
LEFT OUTER JOIN (
SELECT EqDst.FO_MIID, RsDst.FOID, RsDst.EquipmentID
FROM dbo.tbl_FO_Resource AS RsDst INNER JOIN
dbo.tbl_FO_MI_Equipment AS EqDst ON RsDst.ResourceID = EqDst.ResourceID
WHERE (NOT (RsDst.EquipmentID IS NULL))

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 37
FS2 Database Documentation

) AS MiEqDst
ON FO_MI.FO_MiID = MiEqDst.FO_MiID
AND FO_MI.FOID = MiEqDst.FOID
LEFT OUTER JOIN (
SELECT EqTra.FO_MIID, RsTra.FOID, RsTra.EquipmentID
FROM dbo.tbl_FO_Resource AS RsTra INNER JOIN
dbo.tbl_FO_MI_EquipmentTransport AS EqTra ON RsTra.ResourceID = EqTra.ResourceID
WHERE (NOT (RsTra.EquipmentID IS NULL))
) AS MiEqTra
ON FO_MI.FO_MiID = MiEqTra.FO_MiID
AND FO_MI.FOID = MiEqTra.FOID
LEFT OUTER JOIN (
SELECT EqSrc.FO_MIID, RsSrc.FOID, RsSrc.EquipmentID
FROM dbo.tbl_FO_Resource AS RsSrc INNER JOIN
dbo.tbl_FO_MI_EquipmentSource AS EqSrc ON RsSrc.ResourceID = EqSrc.ResourceID
WHERE (NOT (RsSrc.EquipmentID IS NULL))
) AS MiEqSrc
ON FO_MI.FO_MiID = MiEqSrc.FO_MiID
AND FO_MI.FOID = MiEqSrc.FOID
LEFT OUTER JOIN dbo.tbl_FO_MI_EquipmentSource AS EqSource
ON [FO_MI].[FO_MIID]= [EqSource].[FO_MIID]
LEFT OUTER JOIN dbo.tbl_FO_MI_EquipmentTransport AS EqTransport
ON [FO_MI].[FO_MIID]= [EqTransport].[FO_MIID]
LEFT OUTER JOIN dbo.tbl_FO_MI_Equipment AS EqDestination
ON [FO_MI].[FO_MIID]= [EqDestination].[FO_MIID]
INNER JOIN dbo.tbl_FO AS FO
On [FO_MI].[FOID] = [FO].[FOID]
) AS FoMiEquipments
ON ISNULL(MiCode.DestinationEquipmentID,0) = ISNULL(FoMiEquipments.DestinationEquipmentID,0)
AND ISNULL(MiCode.TransportEquipmentID,0) = ISNULL(FoMiEquipments.TransportEquipmentID,0)
AND (ISNULL(MiCode.SourceEquipmentID,0) = ISNULL(FoMiEquipments.SourceEquipmentID,0) OR
FoMiEquipments.MicroInstructionID = 57)
AND ISNULL(MiCode.StreetID,0) = ISNULL(FoMiEquipments.StreetID,0)
AND MiCode.MicroInstructionID = FoMiEquipments.MicroInstructionID
WHERE FoMiEquipments.FO_MIID=@FO_MiID

-- Return the result of the function


RETURN @MiCodeID

END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 38
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

User-Defined Function Name

dbo.fn_GetDeviation

User-Defined Function Parameters

Parameter Name Direction Storage Type Length Precision Scale

@Quantity Input real 4 N/A N/A

@RealQuantity Input real 4 N/A N/A

User-Defined Function Structured Query Language (SQL) Source Code

--
================================================================================
======
-- Name : fn_GetDeviation
-- Functiongroup :
-- Project : 310200 SigmaKalon
-- Development tool : Microsoft SQL Server Management Studio 2005
--
================================================================================
======
-- Description : Bereken de deviatie van de producthoeveelheid en bepaal of deze
-- binnen de tolerantie valt.
--
-- Parameters : @Quantity Geplande hoeveelheid.
-- @RealQuantity Geproduceerde hoeveelheid
--
-- Result : @Result deviatie
--
--
================================================================================
======
-- Date | Version | Name | Changed
-- ------------+---------+---------------+-----------------------------------------------
-- 29-03-2006 | 0.1 | E.M. de Vries | Initial version.
-- ------------+---------+---------------+-----------------------------------------------

CREATE FUNCTION [dbo].[fn_GetDeviation] (@Quantity AS REAL = NULL, @RealQuantity AS REAL = NULL)


RETURNS VARCHAR(20)
AS
BEGIN

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 39
FS2 Database Documentation

DECLARE @Result AS VARCHAR(20)


DECLARE @Tolerance AS REAL
DECLARE @Deviation AS INT

-- Bepaal de ordertolerantie t.b.v. signalering buiten toleranties.


SELECT TOP 1 @Tolerance=[Value]
FROM [dbo].[tbl_FS_Parameters]
WHERE [Parameter] = 'Order_Tolerance'

-- Bepaal deviatie
IF @Quantity = 0 OR @Quantity IS NULL
SET @Quantity = 1

SET @Deviation = (ISNULL(@RealQuantity,0) / @Quantity) * 100

SET @Result = CONVERT(VARCHAR(20),@Deviation) + ' %'

-- Vergelijk deviatie en tolerantie


IF ABS(@Deviation - 100) > @Tolerance
SET @Result = '<--' + @Result

RETURN @Result
END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 40
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

User-Defined Function Name

dbo.fn_GetFloat

User-Defined Function Parameters

Parameter Name Direction Storage Type Length Precision Scale

@value Input float 8 N/A N/A

User-Defined Function Structured Query Language (SQL) Source Code

--
|================================================================================
======
--| Name : fn_GetFloat
--| Functiongroup :
--| Project : 310200 SigmaKalon
--| Development tool : Microsoft SQL Server Management Studio 2005
--
|================================================================================
======
--| Description : Er wordt een float meegegeven aan de functie. De waarde wordt
--| omgezet naar een string.
--|
--| Parameters : @value De float.
--|
--
|================================================================================
======
--| Date | Version | Name | Changed
--|------------+---------+---------------+-----------------------------------------------
--| 22-03-2006 | 0.1 | G.J. Luimes | Initial version.
--|------------+---------+---------------+-----------------------------------------------

CREATE FUNCTION [dbo].[fn_GetFloat] (


@value AS float
)
RETURNS varchar(1000)
AS
BEGIN

DECLARE @result AS varchar(1000)

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 41
FS2 Database Documentation

-- Controleer de float.

IF @value IS NOT NULL


SET @result = REPLACE(LTRIM(STR(@value, 10, 3)), '.', ',')
ELSE
SET @result = ''

RETURN @result
END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 42
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Trigger Name

dbo.tr_MD_EquipmentFOUsage_DELETE

Trigger Structured Query Language (SQL) Source Code

--
|================================================================================
======
--| Name : tr_sv_FS_FO_MIParameters_DELETE
--| Functiongroup :
--| Project : 310200 SigmaKalon
--| Development tool : Microsoft SQL Server Management Studio 2005
--
|================================================================================
======
--| Description :
--|
--| Parameters :-
--|
--
|================================================================================
======
--| Date | Version | Name | Changed
--|------------+---------+---------------+-----------------------------------------------
--| 17-01-2006 | 0.1 | R.A. de Roon | Initial version.
--|------------+---------+---------------+-----------------------------------------------

CREATE TRIGGER [tr_MD_EquipmentFOUsage_DELETE] ON [dbo].[sv_MD_EquipmentFOUsage]


INSTEAD OF DELETE
AS
BEGIN

SET NOCOUNT ON;

DELETE [EquipmentFOUsage]
FROM [tbl_MD_EquipmentFOUsage] AS [EquipmentFOUsage]
INNER JOIN DELETED ON [EquipmentFOUsage].[EquipmentID] = DELETED.[EquipmentID] AND
[EquipmentFOUsage].[FOID] = DELETED.[FOID]
END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 43
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Trigger Name

dbo.tr_MD_EquipmentFOUsage_INSERT

Trigger Structured Query Language (SQL) Source Code

--
|================================================================================
======
--| Name : tr_sv_FS_FO_MIParameters_INSERT
--| Functiongroup :
--| Project : 310200 SigmaKalon
--| Development tool : Microsoft SQL Server Management Studio 2005
--
|================================================================================
======
--| Description :
--|
--| Parameters :-
--|
--
|================================================================================
======
--| Date | Version | Name | Changed
--|------------+---------+---------------+-----------------------------------------------
--| 17-01-2006 | 0.1 | R.A. de Roon | Initial version.
--|------------+---------+---------------+-----------------------------------------------

CREATE TRIGGER [tr_MD_EquipmentFOUsage_INSERT] ON [dbo].[sv_MD_EquipmentFOUsage]


INSTEAD OF INSERT
AS
BEGIN

SET NOCOUNT ON;

INSERT tbl_MD_EquipmentFOUsage ([EquipmentID], [FOID], [PAK], [VRIJ])


SELECT INSERTED.[EquipmentID],
INSERTED.[FOID],
INSERTED.[PAK],
INSERTED.[VRIJ]
FROM INSERTED
END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 44
FS2 Database Documentation

Generation Date and Time

6/29/2008 9:23 PM Return To First Page

Trigger Name

dbo.tr_MD_ResourceEquipment_DELETE

Trigger Structured Query Language (SQL) Source Code

CREATE TRIGGER [dbo].[tr_MD_ResourceEquipment_DELETE] ON [dbo].[sv_MD_ResourceEquipment]


INSTEAD OF DELETE
AS
BEGIN

SET NOCOUNT ON;

DECLARE @ResourceID as int


DECLARE @EquipmentID as int

SELECT @ResourceID= [MD_Resource].[ResourceID]


FROM [dbo].[tbl_MD_Resource] as [MD_Resource]
WHERE [MD_Resource].[Resource] = (SELECT [Resource] FROM DELETED)

SELECT @EquipmentID= [MD_Equipment].[EquipmentID]


FROM [dbo].[tbl_MD_Equipment] as [MD_Equipment]
WHERE [MD_Equipment].[Equipment] = (SELECT [Equipment] FROM DELETED)

DELETE [tbl_MD_ResourceEquipment]
FROM [tbl_MD_ResourceEquipment] AS [MD_ResourceEquipment]
WHERE [ResourceID] = @ResourceID AND
[EquipmentID] = @EquipmentID
END

© 2008 Your Company Name. All rights reserved.


May not be reproduced, distributed or disclosed without the written permission of Your Company Name.
Page 45

You might also like