Produced by Araxis Merge on 10/26/2017 10:43:16 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_BMS_v2_iter 2_September_2017.zip\BMS_Cand\BMS_Build_C72898\BMS_Source-BuildC72898.zip\C72898\Source\Sources\Database\CreationScripts\BMS_DS\4.StoredProcedures | dbo.sp_infoworld_ssis_updateDataForEVSTable.StoredProcedure.sql | Wed Oct 23 12:51:14 2013 UTC |
| 2 | OSCIF_BMS_v2_iter 2_September_2017.zip\BMS_Cand\BMS_Build_C72898\BMS_Source-BuildC72898.zip\C72898\Source\Sources\Database\CreationScripts\BMS_DS\4.StoredProcedures | dbo.sp_infoworld_ssis_updateDataForEVSTable.StoredProcedure.sql | Thu Oct 26 15:55:41 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 168 |
| Changed | 2 | 16 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /****** Ob ject: Sto redProcedu re [dbo].[ sp_infowor ld_ssis_up dateDataFo rEVSTable] Script Date: 03/ 21/2012 15 :21:38 *** ***/ | |
| 2 | IF EXISTS (SELECT * FROM sys. objects WH ERE object _id = OBJE CT_ID(N'[d bo].[sp_in foworld_ss is_updateD ataForEVST able]') AN D type in (N'P', N'P C')) | |
| 3 | DROP PROCE DURE [dbo] .[sp_infow orld_ssis_ updateData ForEVSTabl e] | |
| 4 | GO | |
| 5 | ||
| 6 | SET ANSI_N ULLS ON | |
| 7 | GO | |
| 8 | SET QUOTED _IDENTIFIE R ON | |
| 9 | GO | |
| 10 | ||
| 11 | CREATE PRO CEDURE [db o].[sp_inf oworld_ssi s_updateDa taForEVSTa ble] | |
| 12 | ( | |
| 13 | @t ableName
|
|
| 14 | @p kColumnNam e
|
|
| 15 | @s chemaName nvarchar(1 00) | |
| 16 | ) | |
| 17 | AS | |
| 18 | ||
| 19 | BEGIN | |
| 20 | ||
| 21 | DECLARE @s tringUpdat e
|
|
| 22 | DECLARE @s tringInser t
|
|
| 23 | DECLARE @w hereInsert
|
|
| 24 | DECLARE @w hereUpdate
|
|
| 25 | DECLARE @c urrentPK
|
|
| 26 | DECLARE @s tringUpdat eColumns
|
|
| 27 | ||
| 28 | DECLARE @a ModifyColu mn varchar (256), @SQ L VARCHAR( MAX) | |
| 29 | SELECT @aM odifyColum n = '_ssis _timestamp '; | |
| 30 | ||
| 31 | declare @s ch nvarcha r(250) | |
| 32 | set @sch=' ['+@schema Name+'].' | |
| 33 | ||
| 34 | SET @where Insert = ' where ' | |
| 35 | SET @where Update = ' where' | |
| 36 | SET @curre ntPK = '' | |
| 37 | ||
| 38 | IF CHARIND EX( ',', @ pkColumnNa me ) = 0 | |
| 39 | BE GIN | |
| 40 | SET @whereInse rt = @wher eInsert + 't.[' + @p kColumnNam e + ']=b.[ ' + @pkCol umnName + ']' | |
| 41 | SET @whereUpda te = @wher eUpdate + @sch+'[' + @tableNam e + '].[' + @pkColum nName + '] = t.[' + @pkColumnN ame + ']' | |
| 42 | EN D | |
| 43 | ELSE | |
| 44 | BE GIN | |
| 45 | SET @currentPK = LEFT( @ pkColumnNa me, CHARIN DEX( ',', @pkColumnN ame ) - 1 ) | |
| 46 | ||
| 47 | SET @whereInse rt = @wher eInsert + 't.[' + @c urrentPK + ']=b.[' + @currentP K + ']' | |
| 48 | SET @whereUpda te = @wher eUpdate + @sch+'[' + @tableNam e + '].[' + @current PK + '] = t.[' + @cu rrentPK + ']' | |
| 49 | ||
| 50 | SET @pkColumnN ame = RIGH T( @pkColu mnName, LE N( @pkColu mnName ) - CHARINDEX ( ',', @pk ColumnName ) ) | |
| 51 | ||
| 52 | WHIL E LEN( @pk ColumnName ) > 0 | |
| 53 | BEGI N | |
| 54 | IF CHA RINDEX( ', ', @pkColu mnName ) > 0 | |
| 55 | BEGIN | |
| 56 | SET @curre ntPK = LEF T( @pkColu mnName, CH ARINDEX( ' ,', @pkCol umnName ) - 1 ) | |
| 57 | SET @pkCol umnName = RIGHT( @pk ColumnName , LEN( @pk ColumnName ) - CHARI NDEX( ',', @pkColumn Name ) ) | |
| 58 | END | |
| 59 | ELSE | |
| 60 | BEGIN | |
| 61 | SET @curre ntPK = @pk ColumnName | |
| 62 | SET @pkCol umnName = SPACE(0) | |
| 63 | END | |
| 64 | SET @w hereInsert = @whereI nsert + ' AND t.[' + LTRIM(RTR IM(@curren tPK)) + '] =b.[' + LT RIM(RTRIM( @currentPK )) + ']' | |
| 65 | SET @w hereUpdate = @whereU pdate + ' AND '+@sch +'[' + @ta bleName + '].[' + LT RIM(RTRIM( @currentPK )) + '] = t.[' + LTR IM(RTRIM(@ currentPK) ) + ']' | |
| 66 | END | |
| 67 | EN D | |
| 68 | SE T @whereIn sert = @wh ereInsert + ');' | |
| 69 | SE T @whereUp date = @wh ereUpdate + ';' | |
| 70 | ||
| 71 | SET @strin gInsert = CHAR(13) + '-- ' + + @tableNam e + ' INSE RT' + cha r(13) | |
| 72 | SET @strin gInsert = @stringIns ert + 'INS ERT INTO ' +@sch+'[' + @tableNa me + ']' + CHAR(13) + 'SELECT * FROM [#' + @tableN ame + '] t WHERE NOT EXISTS (S ELECT 1 FR OM '+@sch+ '[' + @tab leName + ' ] b ' + @w hereInsert | |
| 73 | SET @strin gUpdate = CHAR(13) + '-- ' + + @tableNam e + ' UPDA TE' + cha r(13) | |
| 74 | SET @strin gUpdate = @stringUpd ate + 'UPD ATE '+@sch +'[' + @ta bleName + '] WITH (R OWLOCK)' + char(13) + 'SET ' + char(13) | |
| 75 | ||
| 76 | SELECT @st ringUpdate Columns = isnull(@st ringUpdate Columns + ', ' + @sc h+'[' + @t ableName + '].[' + b .NAME + '] = t.[' + b.NAME + ' ] ' + CHAR (13) , @sc h+'[' + @t ableName + '].[' + b .NAME + '] = t.[' + b.NAME + ' ] ' + CHAR (13)) | |
| 77 | FROM sysob jects a | |
| 78 | join syscolumn s b on a.id = b.id | |
| 79 | WHERE a.ty pe = 'U' a nd a.name = @tableN ame | |
| 80 | ||
| 81 | SET @strin gUpdate = @stringUpd ate + @str ingUpdateC olumns | |
| 82 | SET @strin gUpdate = @stringUpd ate + CHAR (13) + 'fr om [#' + @ tableName + '] t' + CHAR(13) + @whereUpd ate | |
| 83 | ||
| 84 | --PRINT 's tring Dele te: '+@str ingDelete | |
| 85 | --PRINT 's tring Upda te: '+@str ingUpdate | |
| 86 | --PRINT 's tring Inse rt: '+@str ingInsert | |
| 87 | ||
| 88 | EXEC SP_EX ECUTESQL @ stringUpda te | |
| 89 | EXEC SP_EX ECUTESQL @ stringInse rt | |
| 90 | ||
| 91 | END | |
| 92 | GO |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.