Thursday, July 5, 2012

COPY Advanced Financials Reports Across Companies

 
Normally you will need to create your balance sheet and paste it over all your companies, script below will do the task for you:
 
Download Link:
 
Script:
--REPLACE Source with your source Company ID
--REPLACE Destination with your destination Company ID
INSERT INTO [Destination].DBO.AF40100 ([RPRTNAME],[REPORTID],[RPRTTYPE],[CLCFRPRT],[LSTMODIF],[NOTEINDX])  SELECT [RPRTNAME],[REPORTID],[RPRTTYPE],[CLCFRPRT],[LSTMODIF],[NOTEINDX] FROM [Source].DBO.AF40100
INSERT INTO [Destination].DBO.AF40101 ([REPORTID],[MNHDRCNT],[MNFTRCNT],[SHDRCNT],[SFTRCNT],[ROWCNT1],[COLCNT],[SHDRPCNT],[SFTRPCNT],[MNHDRFLG],[MNFTRFLG],[SHDRFLAG],[SFTRFLAG],[MNHDRSIZ],[MNFTRSIZ],[SHDRSIZE_1],[SHDRSIZE_2],[SHDRSIZE_3],[SHDRSIZE_4],[SHDRSIZE_5],[SFTRSIZE_1],[SFTRSIZE_2],[SFTRSIZE_3],[SFTRSIZE_4],[SFTRSIZE_5],[SHDROPT_1],[SHDROPT_2],[SHDROPT_3],[SHDROPT_4],[SHDROPT_5],[SHDRPRT_1],[SHDRPRT_2],[SHDRPRT_3],[SHDRPRT_4],[SHDRPRT_5],[SFTROPT_1],[SFTROPT_2],[SFTROPT_3],[SFTROPT_4],[SFTROPT_5],[SFTRPRT_1],[SFTRPRT_2],[SFTRPRT_3],[SFTRPRT_4],[SFTRPRT_5],[COLHDCNT],[COLDHSIZ_1],[COLDHSIZ_2],[COLDHSIZ_3],[COLDHSIZ_4],[COLDHSIZ_5],[COLDHSIZ_6],[RTOTLSIZ],[COLTOSIZ],[COLOFSIZ],[LFTMARGN],[RTMARGIN],[TOPMARGN],[BOTMARGN]) SELECT [REPORTID],[MNHDRCNT],[MNFTRCNT],[SHDRCNT],[SFTRCNT],[ROWCNT1],[COLCNT],[SHDRPCNT],[SFTRPCNT],[MNHDRFLG],[MNFTRFLG],[SHDRFLAG],[SFTRFLAG],[MNHDRSIZ],[MNFTRSIZ],[SHDRSIZE_1],[SHDRSIZE_2],[SHDRSIZE_3],[SHDRSIZE_4],[SHDRSIZE_5],[SFTRSIZE_1],[SFTRSIZE_2],[SFTRSIZE_3],[SFTRSIZE_4],[SFTRSIZE_5],[SHDROPT_1],[SHDROPT_2],[SHDROPT_3],[SHDROPT_4],[SHDROPT_5],[SHDRPRT_1],[SHDRPRT_2],[SHDRPRT_3],[SHDRPRT_4],[SHDRPRT_5],[SFTROPT_1],[SFTROPT_2],[SFTROPT_3],[SFTROPT_4],[SFTROPT_5],[SFTRPRT_1],[SFTRPRT_2],[SFTRPRT_3],[SFTRPRT_4],[SFTRPRT_5],[COLHDCNT],[COLDHSIZ_1],[COLDHSIZ_2],[COLDHSIZ_3],[COLDHSIZ_4],[COLDHSIZ_5],[COLDHSIZ_6],[RTOTLSIZ],[COLTOSIZ],[COLOFSIZ],[LFTMARGN],[RTMARGIN],[TOPMARGN],[BOTMARGN] FROM [Source].DBO.AF40101
INSERT INTO [Destination].DBO.AF40102 ([REPORTID],[HDRFTRTY],[FLDNUM],[FLDPOSX1],[FLDPOSY1],[FLDPOSX2],[FLDPOSY2],[FLDTYPE],[FLDFRMAT],[SBHSBFIN],[FLDOPT],[FLDOPT2],[FLDALIGN],[FLDFTFML],[FLDFTSIZ],[FLDSTYLE_1],[FLDSTYLE_2],[FLDSTYLE_3],[FLDSTYLE_4],[FLDSTYLE_5],[FLDSTYLE_6],[FLDVALUE],[FLDVALU2],[FLDPRNAM]  ) SELECT [REPORTID],[HDRFTRTY],[FLDNUM],[FLDPOSX1],[FLDPOSY1],[FLDPOSX2],[FLDPOSY2],[FLDTYPE],[FLDFRMAT],[SBHSBFIN],[FLDOPT],[FLDOPT2],[FLDALIGN],[FLDFTFML],[FLDFTSIZ],[FLDSTYLE_1],[FLDSTYLE_2],[FLDSTYLE_3],[FLDSTYLE_4],[FLDSTYLE_5],[FLDSTYLE_6],[FLDVALUE],[FLDVALU2],[FLDPRNAM]   FROM [Source].DBO.AF40102
INSERT INTO [Destination].DBO.AF40103 ([REPORTID],[COLNUM],[CLTKNCNT],[COLTYPE],[COLSIZE],[COLOMCNT],[COLOFMRK_1],[COLOFMRK_2],[COLOFMRK_3],[COLOFMRK_4],[HIDEFLAG],[TEXTVALU],[STPERIOD],[ENDPEROD],[AMNTFROM],[HISTYEAR],[BUDID],[PRTSIGN],[PRTCOMMA],[PRTPCENT],[PRTTEXT],[ROUNDOPT],[HEADALIN],[HDFTFMLY],[HDFTSIZE],[HEDSTYLE_1],[HEDSTYLE_2],[HEDSTYLE_3],[HEDSTYLE_4],[HEDSTYLE_5],[HEDSTYLE_6],[HEADTYPE_1],[HEADTYPE_2],[HEADTYPE_3],[HEADTYPE_4],[HEADTYPE_5],[HEADTYPE_6],[HEDFRMAT_1],[HEDFRMAT_2],[HEDFRMAT_3],[HEDFRMAT_4],[HEDFRMAT_5],[HEDFRMAT_6],[HEADOPT_1],[HEADOPT_2],[HEADOPT_3],[HEADOPT_4],[HEADOPT_5],[HEADOPT_6],[HEADOPT2_1],[HEADOPT2_2],[HEADOPT2_3],[HEADOPT2_4],[HEADOPT2_5],[HEADOPT2_6],[COLHDNG_1],[COLHDNG_2],[COLHDNG_3],[COLHDNG_4],[COLHDNG_5],[COLHDNG_6],[COLHDNG2_1],[COLHDNG2_2],[COLHDNG2_3],[COLHDNG2_4],[COLHDNG2_5],[COLHDNG2_6],[ALGNOFST],[COLEXPER],[NOTEINDX],[SEGFROM_1],[SEGFROM_2],[SEGFROM_3],[SEGFROM_4],[SEGFROM_5],[SEGFROM_6],[SEGFROM_7],[SEGFROM_8],[SEGFROM_9],[SEGFROM_10],[SEGTO_1],[SEGTO_2],[SEGTO_3],[SEGTO_4],[SEGTO_5],[SEGTO_6],[SEGTO_7],[SEGTO_8],[SEGTO_9],[SEGTO_10]) SELECT [REPORTID],[COLNUM],[CLTKNCNT],[COLTYPE],[COLSIZE],[COLOMCNT],[COLOFMRK_1],[COLOFMRK_2],[COLOFMRK_3],[COLOFMRK_4],[HIDEFLAG],[TEXTVALU],[STPERIOD],[ENDPEROD],[AMNTFROM],[HISTYEAR],[BUDID],[PRTSIGN],[PRTCOMMA],[PRTPCENT],[PRTTEXT],[ROUNDOPT],[HEADALIN],[HDFTFMLY],[HDFTSIZE],[HEDSTYLE_1],[HEDSTYLE_2],[HEDSTYLE_3],[HEDSTYLE_4],[HEDSTYLE_5],[HEDSTYLE_6],[HEADTYPE_1],[HEADTYPE_2],[HEADTYPE_3],[HEADTYPE_4],[HEADTYPE_5],[HEADTYPE_6],[HEDFRMAT_1],[HEDFRMAT_2],[HEDFRMAT_3],[HEDFRMAT_4],[HEDFRMAT_5],[HEDFRMAT_6],[HEADOPT_1],[HEADOPT_2],[HEADOPT_3],[HEADOPT_4],[HEADOPT_5],[HEADOPT_6],[HEADOPT2_1],[HEADOPT2_2],[HEADOPT2_3],[HEADOPT2_4],[HEADOPT2_5],[HEADOPT2_6],[COLHDNG_1],[COLHDNG_2],[COLHDNG_3],[COLHDNG_4],[COLHDNG_5],[COLHDNG_6],[COLHDNG2_1],[COLHDNG2_2],[COLHDNG2_3],[COLHDNG2_4],[COLHDNG2_5],[COLHDNG2_6],[ALGNOFST],[COLEXPER],[NOTEINDX],[SEGFROM_1],[SEGFROM_2],[SEGFROM_3],[SEGFROM_4],[SEGFROM_5],[SEGFROM_6],[SEGFROM_7],[SEGFROM_8],[SEGFROM_9],[SEGFROM_10],[SEGTO_1],[SEGTO_2],[SEGTO_3],[SEGTO_4],[SEGTO_5],[SEGTO_6],[SEGTO_7],[SEGTO_8],[SEGTO_9],[SEGTO_10] FROM [Source].DBO.AF40103
INSERT INTO [Destination].DBO.AF40104 ([REPORTID],[CLCOLNUM],[TKNODNUM],[TKNTYPE],[TKNVALUE],[TKNDLVAL],[TKNUNACT_1],[TKNUNACT_2],[TKNUNACT_3],[TKNUNACT_4],[TKNUNACT_5],[TKNUNACT_6],[TKNUNACT_7],[TKNUNACT_8],[TKNUNACT_9],[TKNUNACT_10]) SELECT [REPORTID],[CLCOLNUM],[TKNODNUM],[TKNTYPE],[TKNVALUE],[TKNDLVAL],[TKNUNACT_1],[TKNUNACT_2],[TKNUNACT_3],[TKNUNACT_4],[TKNUNACT_5],[TKNUNACT_6],[TKNUNACT_7],[TKNUNACT_8],[TKNUNACT_9],[TKNUNACT_10] FROM [Source].DBO.AF40104
INSERT INTO [Destination].DBO.AF40105 ([REPORTID],[CLCOLNUM],[TKNODNUM],[TKNTYPE],[TKNVALUE],[TKNDLVAL],[TKNUNACT_1],[TKNUNACT_2],[TKNUNACT_3],[TKNUNACT_4],[TKNUNACT_5],[TKNUNACT_6],[TKNUNACT_7],[TKNUNACT_8],[TKNUNACT_9],[TKNUNACT_10]     ) SELECT [REPORTID],[CLCOLNUM],[TKNODNUM],[TKNTYPE],[TKNVALUE],[TKNDLVAL],[TKNUNACT_1],[TKNUNACT_2],[TKNUNACT_3],[TKNUNACT_4],[TKNUNACT_5],[TKNUNACT_6],[TKNUNACT_7],[TKNUNACT_8],[TKNUNACT_9],[TKNUNACT_10]FROM [Source].DBO.AF40105
INSERT INTO [Destination].DBO.AF40106 ([REPORTID],[ROWNUMBR],[TOTKNCNT],[ROWTYPE],[ROWSIZE],[ROLUPFLG],[ROWDESC],[SUBSUDID],[TYPCLBAL],[CATNUMBR],[PRTSIGN],[PRTHEDER],[CENTHEDR],[ROWFTFAM],[ROWFTSIZ],[ROWSTYLE_1],[ROWSTYLE_2],[ROWSTYLE_3],[ROWSTYLE_4],[ROWSTYLE_5],[ROWSTYLE_6],[ROFMRKIN_1],[ROFMRKIN_2],[ROFMRKIN_3],[ROFMRKIN_4],[ROFMRKIN_5],[ROFMRKIN_6],[ROFMRKIN_7],[ROFMRKIN_8],[ROFMRKIN_9],[ROFMRKIN_10],[ROFMRKIN_11],[ROFMRKIN_12],[ROFMRKIN_13],[ROFMRKIN_14],[ROFMRKIN_15],[ROFMRKIN_16],[ROFMRKIN_17],[ROFMRKIN_18],[ROFMRKIN_19],[ROFMRKIN_20],[ROFMRKIN_21],[ROFMRKIN_22],[ROFMRKIN_23],[ROFMRKIN_24],[ROFMRKIN_25],[ROFMRKIN_26],[ROFMRKIN_27],[ROFMRKIN_28],[ROFMRKIN_29],[ROFMRKIN_30],[ROFMRKIN_31],[ROFMRKIN_32],[ROFMRKIN_33],[ROFMRKIN_34],[ROFMRKIN_35],[ROFMRKIN_36],[ROFMRKIN_37],[ROFMRKIN_38],[ROFMRKIN_39],[ROFMRKIN_40],[CFLOSCTN],[RWEXPERR],[NOTEINDX],[STTACCT_1],[STTACCT_2],[STTACCT_3],[STTACCT_4],[STTACCT_5],[STTACCT_6],[STTACCT_7],[STTACCT_8],[STTACCT_9],[STTACCT_10],[ENDACCT_1],[ENDACCT_2],[ENDACCT_3],[ENDACCT_4],[ENDACCT_5],[ENDACCT_6],[ENDACCT_7],[ENDACCT_8],[ENDACCT_9],[ENDACCT_10]) SELECT [REPORTID],[ROWNUMBR],[TOTKNCNT],[ROWTYPE],[ROWSIZE],[ROLUPFLG],[ROWDESC],[SUBSUDID],[TYPCLBAL],[CATNUMBR],[PRTSIGN],[PRTHEDER],[CENTHEDR],[ROWFTFAM],[ROWFTSIZ],[ROWSTYLE_1],[ROWSTYLE_2],[ROWSTYLE_3],[ROWSTYLE_4],[ROWSTYLE_5],[ROWSTYLE_6],[ROFMRKIN_1],[ROFMRKIN_2],[ROFMRKIN_3],[ROFMRKIN_4],[ROFMRKIN_5],[ROFMRKIN_6],[ROFMRKIN_7],[ROFMRKIN_8],[ROFMRKIN_9],[ROFMRKIN_10],[ROFMRKIN_11],[ROFMRKIN_12],[ROFMRKIN_13],[ROFMRKIN_14],[ROFMRKIN_15],[ROFMRKIN_16],[ROFMRKIN_17],[ROFMRKIN_18],[ROFMRKIN_19],[ROFMRKIN_20],[ROFMRKIN_21],[ROFMRKIN_22],[ROFMRKIN_23],[ROFMRKIN_24],[ROFMRKIN_25],[ROFMRKIN_26],[ROFMRKIN_27],[ROFMRKIN_28],[ROFMRKIN_29],[ROFMRKIN_30],[ROFMRKIN_31],[ROFMRKIN_32],[ROFMRKIN_33],[ROFMRKIN_34],[ROFMRKIN_35],[ROFMRKIN_36],[ROFMRKIN_37],[ROFMRKIN_38],[ROFMRKIN_39],[ROFMRKIN_40],[CFLOSCTN],[RWEXPERR],[NOTEINDX],[STTACCT_1],[STTACCT_2],[STTACCT_3],[STTACCT_4],[STTACCT_5],[STTACCT_6],[STTACCT_7],[STTACCT_8],[STTACCT_9],[STTACCT_10],[ENDACCT_1],[ENDACCT_2],[ENDACCT_3],[ENDACCT_4],[ENDACCT_5],[ENDACCT_6],[ENDACCT_7],[ENDACCT_8],[ENDACCT_9],[ENDACCT_10] FROM [Source].DBO.AF40106
INSERT INTO [Destination].DBO.AF40107 ([REPORTID] ,[TOTRWNUM],[TKNODNUM],[STROWNUM],[ENDRWNUM]) SELECT [REPORTID] ,[TOTRWNUM],[TKNODNUM],[STROWNUM],[ENDRWNUM] FROM [Source].DBO.AF40107
INSERT INTO [Destination].DBO.AF40108 ([REPORTID],[TOTRWNUM],[MBRWNUM]) SELECT [REPORTID],[TOTRWNUM],[MBRWNUM] FROM [Source].DBO.AF40108
INSERT INTO [Destination].DBO.AF40109 ([FLDPRNAM],[FLDPCTUR]) SELECT [FLDPRNAM],[FLDPCTUR] FROM [Source].DBO.AF40109
--INSERT INTO [Destination].DBO.AF40110 ([USERNAME],[SHGRDFLG],[SHCGRFLG],[SHTBARFL],[SCDEFAFL],[SHRWARFL],[SHOFMKFL],[SNPTGRFL],[SHMARFLG],[SHPGBDFL],[SHRLRSFL] ) SELECT [USERNAME],[SHGRDFLG],[SHCGRFLG],[SHTBARFL],[SCDEFAFL],[SHRWARFL],[SHOFMKFL],[SNPTGRFL],[SHMARFLG],[SHPGBDFL],[SHRLRSFL]  FROM [Source].DBO.AF40110




Regards,
--
Mohammad R. Daoud MVP - MCT
MCP, MCBMSP, MCTS, MCBMSS
+962 - 79 - 999 65 85
me@mohdaoud.com
www.mohdaoud.com

No comments:

Related Posts:

Related Posts with Thumbnails