Your SlideShare is downloading. ×
SQL Reporting Process
Background, Process, and Examples
Updated: July2013
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxx...
Table of Contents
Introduction ..............................................................................................
1
Introduction
Purpose:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxx...
2
Notes / Potential Issues:
1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
a. xxxxxxxxxxxxxxxxxxxxxxxx
b. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
3
Methodology
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx...
4
Documentation
o Goal
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxx...
5
Additional Resources
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
...
6
Running The SQL Script for xxxxxxxxxxxxxxxxxxxxx
Running the report:
Below are the sequential steps for completing the S...
7
2. Click Connect.
ii. You are now connected: The top left corner of the screen will look like this…
3. Running the scrip...
8
c. Paste Script into Toad
i. Copy & paste entire script from attached file or the same script below. It will
look like t...
9
Note: The Single apostrophes on either end of the term are required by Toad.
xxxxxxxxxxxxxxxxxx.
e. Run the Script
i. xx...
10
g. Export Results into Excel file
i. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx...
11
Appendices
1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3. xxxxxxxxxxxxxxx
4. xx...
12
Methodology Highlights –Example
Below is an example of highlights included in the Excel spreadsheet portion of the deli...
13
Narrative – Example
Below is an example of the Narrative portion of the deliverable which accompanies the Excel repor.
...
14
SQL Script
Copy and paste this entire script below into a new Editor within your SQL server application (e.g. Toad).
To...
15
--print @xxxx_BEGIN print @xxxx_END
--endregion
--region Drop xxxxxxxxx of tables
IF OBJECT_ID(N'xxxx..##xxxxx_xxxxxx, ...
16
,[xxxxxxxxxxx] varchar(30)
,[xxxxxx] varchar(10)
,[xxxxxxxxxxxxxxxxxxxxx] varchar(30)
,[xxxxxxxxxxx] decimal(2,1) not n...
17
insert into xxxxxx
([xxxxxxxxxxxxxxxxx],[xxxxxxxxxxxx],[xxxxxx],[xxxxxxxxxxxxxxxx)
values ('xxxx','xxx','xxxxxxxxx','xx...
18
insert into ##xxxxxxxxxxxxx ([xxx],[xxxxxxxxxxxx],[xxxxxxx],[xxxxx
values ('xxxxxxxxxxxx','xxx,'xxxxxxxxxx','xxx')
valu...
19
END
--endregion
--region (4) xxxxxxxxx(change xxxxx)
--region (1) Create xxxxxxxxxxxxxxxxxx Table
CREATE TABLE##xxxxxxx...
20
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--endregion
--region (5) xxxxxxxxxxxxxxxxxxxxx...
21
--region (6) xxxxxxxxxxxx (change xxx)
--region (6.1) Build xxxxxxxxxxxx Table
CREATE TABLE##xxxxxxxxxxxxx
(
xxxxxxxvar...
22
xxxxxxxxxxxxxxxxxDefinitions
Note: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
23
24
25
xxxxxxxxxxxxxxxxxxxxxxxxxxx Descriptions
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
26
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx...
Upcoming SlideShare
Loading in...5
×

Process documentation: SQL

165

Published on

Detailed SQL process documentation

Published in: Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
165
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Process documentation: SQL"

  1. 1. SQL Reporting Process Background, Process, and Examples Updated: July2013 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx
  2. 2. Table of Contents Introduction ..................................................................................................................................................1 Notes / Potential Issues: ...........................................................................................................................2 Methodology.................................................................................................................................................3 Documentation .............................................................................................................................................4 Additional Resources ....................................................................................................................................5 Running The SQL Script for xxxxxxxxxxxxxxxxxxxxx ......................................................................................6 Appendices..................................................................................................................................................11 Methodology Highlights –Example.........................................................................................................12 Narrative – Example................................................................................................................................13 SQL Script................................................................................................................................................14 xxxxxx xxxxxxxxxxx Definitions................................................................................................................22 xxxxxxxxxxxxxxxxxxxxxxxxxxx Descriptions.............................................................................................25
  3. 3. 1 Introduction Purpose:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx). b. Narrative: A summary report (Example)which includes … i. xxxxxxxxxxxxxxxxx ii. Logic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx iii. Data Analysis: xxxxxxxxxxxxxxxxxxxxxx 1. xxxxxxxxxxxxxxxxxxxxxxxxx 2. xxxxxxxxxxxxxxxxxxxxxxxxxxxx iv. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) 6. Recipients: a. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. Questions?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
  4. 4. 2 Notes / Potential Issues: 1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxx a. xxxxxxxxxxxxxxxxxxxxxxxx b. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxx c. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx d. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx a. xxx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xxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3. xxxxxxxxxxxxxxxxxxxxx 4. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 5. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  8. 8. 6 Running The SQL Script for xxxxxxxxxxxxxxxxxxxxx Running the report: Below are the sequential steps for completing the SQL reporting scripts. A full copy of the actual file [file name] is located in [folder name]. 1. Open SQL Server (e.g. Toad) a. Click on Toad Icon on your Desktop or … b. Click Start>All Programs>Quest Software>Toad for SQL Server. 2. Connect to Server and database a. Connect to Server: xxxxxxxxxx: i. Click File>New>Connection: this popup appears … 1. Enter the following in the popup… a. Server Name: xxxxxxxx b. Authentication: SQL Server Authentication c. Login: xxxxxxxx d. Password: xxxxxxxxxxxx e. Database: Browse and select xxxxxxx(xxxxxxxxxxxx) f. After input result will read “xxxxxx” (see images below)
  9. 9. 7 2. Click Connect. ii. You are now connected: The top left corner of the screen will look like this… 3. Running the script a. Open new Editor: This the portion of the screen where you will enter SQL scripts. b. Click “File>New>Editor”.
  10. 10. 8 c. Paste Script into Toad i. Copy & paste entire script from attached file or the same script below. It will look like this … d. Input: Enterxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i. Syntax: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ii. Example: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  11. 11. 9 Note: The Single apostrophes on either end of the term are required by Toad. xxxxxxxxxxxxxxxxxx. e. Run the Script i. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ii. The result will look like this … iii. Click and drag your mouse to highlight lines 12 - 17 in the script … iv. To run the SQL script, Click Editor>ExecuteSQLorPress F5. f. View & Save Results i. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  12. 12. 10 g. Export Results into Excel file i. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx). ii. Click on Save Asand save the file (Save as type: Excel Workbook). 1. You might use a file name like xxxxxxxxxxxxxxxxxxxxxxxx. h. Review and Prepare the Report in Excel i. Once you have opened the Excel file with the SQL query results, check for errors or inconsistencies. ii. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx iii. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. i. Report Delivery i. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx
  13. 13. 11 Appendices 1. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 3. xxxxxxxxxxxxxxx 4. xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 5. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  14. 14. 12 Methodology Highlights –Example Below is an example of highlights included in the Excel spreadsheet portion of the deliverable. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1. Definition: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx a. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx a. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  16. 16. 14 SQL Script Copy and paste this entire script below into a new Editor within your SQL server application (e.g. Toad). To open a new editor within Toad, click File>New>Editor. --Step I:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) xxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxx --Step II: xxxxxxxxxxxxxxxxxxx --Ixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxxxxxxxxxxxx DECLARE@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxVARCHAR(100) set @xxxxxxxBEGIN=xxxxxxxxx' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --region xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --region Terms xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) SET xxxxxxxxxxxx=CASE WHEN UPPER(@xxxxxxx_xxxxxxxx) LIKE 'xxxx%' THEN LEFT(RIGHT(RTRIM(@xxxxxxxx_BEGIN), 4),1)+SUBSTRING(RIGHT(Rxxxx(@xxxx_BEGIN), 4),3,2)+'2' WHEN UPPER(@xxxxx_BEGIN) LIKE 'xxx%' THEN LEFT(RIGHT(RTRIM(@xxxxx_BEGIN), 4),1)+SUBSTRING(RIGHT(RTRIM(@xxxx_BEGIN), 4),3,2)+'4' WHEN UPPER(@xxxx_BEGIN) LIKE 'xxx' THEN LEFT(RIGHT(RTRIM(@xxxx_BEGIN), 4),1)+SUBSTRING(RIGHT(RTRIM(@xxx_BEGIN), 4),3,2)+'6' WHEN UPPER(@xxxx_BEGIN) LIKE 'xx' THEN LEFT(RIGHT(RTRIM(convert(varchar(10),(convert(int, RIGHT(RTRIM(@xxxx_BEGIN), 4))+1))),4),1) +SUBSTRING(RTRIM(convert(varchar(10),convert(int,(RIGHT(RTRIM(@xxxx_BEGIN), 4)+1)),4)),3,2)+'2' ELSE 'Not xxxxxxxxxxxxxxxxxxx’ END SET @xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx THEN LEFT(RIGHT(RTRIM(@xxxxx_END), 4),1)+SUBSTRING(RIGHT(RTRIM(@xxxxx_END), 4),3,2)+'2'xxxxxxxxxxxxxxxxxxxxxxxxx(RIGHT(RTRIM(@TERM_END), 4),1)+SUBSTRING(RIGHT(RTRIMxxxxxxxxx), 4),3,2)+'4' WHEN xxxxxxxxxxxxxx 'FA%' THEN LEFT(RIGHT(RTRIM(@TERM_END), 4),1)+SUBSTRING(RIGHT(RTRIM(@xxxx_END), 4),3,2)+'6' WHEN xxxxxx) LIKE xxxxxxxx THEN LEFT(RIGHT(RTRIM(convert(varchar(10),(convert(int, RIGHT(RTRIM(@xxxx_END), 4))+1))),4),1) +SUBSTRING(RTRIM(convert(varchar(10),convert(int,(RIGHT(RTRIM(@TERM_END), 4)+1)),4)),3,2)+'2' ELSE 'Not a valid semester' END
  17. 17. 15 --print @xxxx_BEGIN print @xxxx_END --endregion --region Drop xxxxxxxxx of tables IF OBJECT_ID(N'xxxx..##xxxxx_xxxxxx, N'U') IS NOT NULL droptable##xxxxxxx_TBL IF OBJECT_ID(N'txxxxx..##xxxx_COMP_TBL', N'U') IS NOT NULL DROP TABLE##xxxxx_COMP_TBL IF OBJECT_ID(N'xxxxxxxx..##Exxxxxxxx_DT_TBL', N'U') IS NOT NULL DROP TABLE##xxxxxxxxxxx_DT_TBL IF OBJECT_ID(N'xxxxxxxxx..##xxxxxxxxxxx_TBL', N'U') IS NOT NULL DROP TABLE##xxxxxxxxx_TBL IF OBJECT_ID(xxxxxxxxxxxGRADE_SUM_TBL', N'U') IS NOT NULL DROP TABLE##xxxxxxxxxxxx --endregion --region (1) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CREATE TABLE##xxxxxxxxxxxxxxxxxxx ( xxxxCHAR(4) ,[xxxxxxx] VARCHAR(30) ,xxxxxxxxxxxVARCHAR(8) ,xxxxxxxxxxxVARCHAR(6) ,xxxxxxxxVARCHAR(100) ,xxxxxxVARCHAR(10) ,xxxxVARCHAR(10) ,xxxxxxVARCHAR(4) ,xxxxxxxxxxVARCHAR(3) ,xxxxxxxxNBRINT ,[xxxxxxxxxxxchar(1) not null default 'Y' ,[xxxxxxxxxxxxxxxxxxxxx] varchar(200) not null default '' ,[xxxxxxxxxxxxxx] int not null default 0 ,[xxxxxxxxxxx] decimal(5,1) not null default -999.0 ,[xxxxxxxxxxxxxxxx] int not null default 0 ,[xxxxxxxxxxxxxxx] int not null default 0 ) --endregion --region (2) xxxxxxxx Table --region (1) xxxxxxxxxxxxxxxxDesc CREATE TABLE##xxxxxxxxxxxxxx_TBL ( ID int not null primary key identity ,[xxxxxxxxxx] varchar(3)
  18. 18. 16 ,[xxxxxxxxxxx] varchar(30) ,[xxxxxx] varchar(10) ,[xxxxxxxxxxxxxxxxxxxxx] varchar(30) ,[xxxxxxxxxxx] decimal(2,1) not null default 0.0 ,[xxxxxxxx?] char(1) not null default 'N' ,[xxxxxxxxxxxxxxxxxxxxxvarchar(30) ) --endregion --region (2) Populate xxxxxxxxxxxxxx INSERT INTO ##xxxxxxxxxxxxxTBL ([xxxxxxxxxx],[xxxxx] ,[xxxxxxxxxx],[xxxxxxxxxxx], [xxxxxxxxxxxxxxxxxxxxx ( SELECT DISTINCT xxxxxxxxxxxxxx, xxxxxxxxxxxxINPUT, xxxxxxxx, xxxxxxxxxxxxx, xxxxxxxxxx, xxxxxxxxxxx FROM xxxxxxxxxxxxx AS x JOIN xxxxxxxxxxxxx_TBL AS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxONxxxxxxxxxxxxxxx WHERE xxxxx=(SELECT MAX(xxxxxxx) xxxxxxxxxxx AS xxx WHERE xxxxxxxxxxxxxxxxxx AND xxxxxxxxxxxx=xxxxxxxx) AND xxxxxxxxxxx=(xxxxxxxx(xxxxxxxxxxx) FROM xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxx=xxxxxxxxxxxx) ) INSERT INTO ##xxxxxxxxxxxx ([xxxxxxxxxxxxxxx], [xxxxxxxxxxxx?],[xxxxxxxxxxxx) ( SELECT DISTINCT xxxxxxxxx, [xxxx]=' ', [xxxxxxxxxxxxxx]=' ', [xxxxxxxxxxxxx]=0.0 ,[xxx]='N', [xxxxxxxxxxxxxxxx?]='N' FROM xxxxxxxxxxx AS x WHERE xxxxxxxxx NOT IN (SELECT xxxxxxxx FROM xxxxxxxx_TBL) ) --endregion --region (3) xxxxxxxxxxxxxxxxxxxxxxx UPDATE ##xxxxxxxxxx_TBL SET [xxxxxxxxxxxxx]=xxxxxxxxxxxxx FROM ##xxxxxxxxxxx AS xxx JOIN xxxxxxxxxx_TBL AS xxxxxxxx.[xxxxxx]=xxxxxxxxxx WHERE xxx=(SELECT MAX(xxxxxxx) FROM xxxxxxxxx_TBLxxxx WHERE xxxxxxxxx=xxxxxxxx) --endregion --region (4) xxxxxx insert into xxxxxxx ([xxxxxxxx],[xxxxxxxxxxxxx],[xxxxxx],[xxxxxxxxxxxxxxx]) values (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) insert into xxxxxxxxx ([xxxxxxxxx],[xxxxxxxxxxxxxxxxx],[xxxxxxxx],[xxxxxxxxxxxxxxxxxx) values ('xxxxx','xxxx','xxxxxxxxxxx','xxx')
  19. 19. 17 insert into xxxxxx ([xxxxxxxxxxxxxxxxx],[xxxxxxxxxxxx],[xxxxxx],[xxxxxxxxxxxxxxxx) values ('xxxx','xxx','xxxxxxxxx','xxxxxx') insert into xxxxxxxxx ([xxxxxxxxx],[xxxxxxxxxxxxxxxxx],[xxxxx],[xxxxxxxx) values ('xxx','xxxxxxxxx','xxxxxxx','xxxxxxxx') insert into xxxxxxx ([xxxxxxxxx],xxxxx],[xxxxxxxxxxxxx],[xxxxxxxxxxxxxx) values ('xxxxx','xxxxxxx','xxxxxxx','xxx') insert into xxxxxxxxx ([xxxxxxxxx],[xxxxx],[xxxxxxxxxx],[xxxxxxxxx) values ('xxxx','xxxxx','xxxxxxxx','xxx') insert into xxxxxxx ([xxxxxxxxx],[xxxxxxxxxxxxxxx],[xxxxx],[xxxxxxxxxxx) values ('xxxx','xxxxxx','xxxxxxxxx','xxxxxx') insert into xxxxxxxxxxx ([xxxxxxxxx],[xxxxxxxxxxxxxxxxx],[xxxxxxxxxxx],[xxxxxxxxxxxxxxxxxx) values ('xxxx','xxxx','xxxxxxxxx','xxx') ([xxxxxxxxx],[xxxxx],[xxxxxxxxxx],[xxxxxxxxx) values ('xxxx','xxxxx','xxxxxxxx','xxx') insert into xxxxxxx ([xxxxxxxxx],xxxxx],[xxxxxxxxxxxxx],[xxxxxxxxxxxxxx) values ('xxxxx','xxxxxxx','xxxxxxx','xxx') insert into xxxxxxxxx --endregion --region (5) xxxxxxxxx insert into ##xxxxxxxxxxxxx([xxx],[xxxxxxxxx],[xxxxxxxx],[xxxx values ('xxxxx','xxxxxxxxx','xx','xxxxxxxxx') insert into ##xxxxxxxxxxxxx ([xxx],[xxxxxxxxxxxx],[xxxxxxx],[xxxxx values ('xxxxxxxxxxxx','xxx,'xxxxxxxxxx','xxx') insert into ##xxxxxxxxxxxxx ([xxx],[xxxxxxxxx],[xxxxxxxx],[xxxx values ('xxxxx','xxxxxxxxx','xx','xxxxxxxxx') values ('xxxxx','xxxxxxxxx','xx','xxxxxxxxx') insert into ##xxxxxxxxxxxxx ([xxx],[xxxxxxxxxxxx],[xxxxxxx],[xxxxx insert into ##xxxxxxxxxxxxx],[xxxxxxxxx],[xxxxxxxx],[xxxx values ('xxxxx','xxxxxxxxx','xx','xxxxxxxxx')
  20. 20. 18 insert into ##xxxxxxxxxxxxx ([xxx],[xxxxxxxxxxxx],[xxxxxxx],[xxxxx values ('xxxxxxxxxxxx','xxx,'xxxxxxxxxx','xxx') values ('xxxxx','xxxxxxxxx','xx','xxxxxxxxx') insert into ##xxxxxxxxxxxxx ([xxx],[xxxxxxxxxxxx],[xxxxxxx],[xxxxx insert into ##xxxxxxxxxxxxx ([xxxxxxxx],[xxxx],[xxxxxxxxxxxxxxx],[xxxxx]) values ('xxxxxxx',xxxxx,'xxxxxxxxxx,'xx') insert into ##xxxxxxxxxxxxx ([xxxxxxxx],[xxxx],[xxxxxxxxxxxxxxx],[xxxxx]) values ('xxxxxxx',xxxxx,'xxxxxxxxxx,'xx') insert into ##xxxxxxxxxxxxx ([xxxxxxxx],[xxxx],[xxxxxxxxxxxxxxx],[xxxxx]) values ('xxxxxxx',xxxxx,'xxxxxxxxxx,'xx') insert into ##xxxxxxxxxxxxx ([xxxxxxxx],[xxxx],[xxxxxxxxxxxxxxx],[xxxxx]) values ('xxxxxxx',xxxxx,'xxxxxxxxxx,'xx') insert into ##xxxxxxxxxxxxx ([xxxxxxxx],[xxxx],[xxxxxxxxxxxxxxx],[xxxxx]) values ('xxxxxxx',xxxxx,'xxxxxxxxxx,'xx') --endregion --region (6) xxxxxxxxxxxxxxxxxx UPDATE ##xxxxxxxxxxxxxx [xxxxxxxxxx]='xxxxxxxxxx '+rtrim([xxxxx])+' ('+[xxxxxxxxxxx]+')' --endregion --region (3) xxxxxxxxxxxxx DECLARE @xxxxxint, @xxxxvarchar(30), @xxxxxxxxxxxxxxxxxvarchar(60) SET @xxxxxxxxxxx=1 WHILE(@xxxxt<=(SELECT MAX(xxxx) FROM ##xxxxxxxxxxxxxxxxxxxxxx_TBL)) BEGIN SELECT @xxxxxxxe=[xxxxxxxxxxx] FROM ##xxxxxxxxxxxxx WHERE ID=@xxxxx SET @xxxxxxxxxxxl='ALTER TABLE ##xxxxxxxxxxxxxxxxxx ADD ['+rtrim(@xxxxxx)+'] int not null default 0' --print @xxxxxxxxxxxxxxx --print @xxxxxxxxxxxx exec(xxxxxxxxxxxxx) set @xxxxxxx=@xxxxx+xxx
  21. 21. 19 END --endregion --region (4) xxxxxxxxx(change xxxxx) --region (1) Create xxxxxxxxxxxxxxxxxx Table CREATE TABLE##xxxxxxxxxx ( xxxxxxxxxVARCHAR(6) ,xxxxxxxxxxx_NBRSMALLINT ,xxxxxxxCHAR(4xxxxxxxxxxxxchar(4) ,xxxxxxxxxxCHAR(3) ,xxxxVARCHAR(4) ,xxxxxxxxVARCHAR(8), xxxxxxxxxxxxxxxxxxVARCHAR(100) ,xxxxxxxxxVARCHAR(10),xxxxxxxxxARCHAR(100) ,xxxxxxxxxxxxxxxx --xxxxxxxxxxxxx ,xxxxVARCHAR(8) not null default '' --xxxxxxxxxxxx_xxxint, xxxxxxxxint, xxxxxxxxxxint ,xxxxxxxxxxxxCHAR(1) ) --endregion --region (2) populate xxxxxxxxxxxx table INSERT INTO xxxxxxxx (xxxx, xxxxxxxxx) ( SELECT DISTINCT xxxxxxx, xxx FROM [xxx].[xxxxxx].[dbo].[xxxxxxxxx_TBL] WHERE (xxxx between @xxxxxxxxxxxxxxxxxxEND) AND xxxxx<>'x' AND xxxxxxxxx NOT IN ('6') --AND xxxxxxxxxx>0 ) --endregion --region (3) update xxxxxxxxxxxxxxx UPDATE ##xxxxxxxx_TBL SET xxxxxxx=xxxxxxxxx, xxxxxx_xxxxxx_xxxxxxxxxxx=xxxxxxxx, xxxxxxxxxxx=xxxxxxxxxxxx ,xxxx=xxxxxxxx, xxxxxx=xxxxxx, xxxxxxxxx ,xxxxxx =CASE WHEN LEN(LTRIM(RTRIM(xxxxxxx)))>x THEN RTRIM(xxxxxx)+LTRIM(RTRIM(xxxxxxx)) ELSE RTRIM(xxxxxxxx)+RIGHT(('00'+LTRIM(RTRIM(xxxxxxx))),x) END ,xxxxxxxx=xxxxxxxxxx ,xxxxxxxxxxxxxxxxxxxxxxxxxxx FROM ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxx JOIN
  22. 22. 20 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --endregion --region (5) xxxxxxxxxxxxxxxxxxxxx --not the xxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx UPDATE ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxxxx UPDATE ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxx --xxxxxxxxxxxxxxxxx --endregion --region (6)xxxxxxxxxxxxxxxxxxxxxxxx UPDATE ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx FROM ##xxxxxxxxxxxxxxxxxxxxxxx JOIN xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --endregion --region (7)xxxxxxxxxxxxxxxxxxxxxxxxxx UPDATE ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CASE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ELSE '' END --endregion --endregion --region (5) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx INSERT INTO ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ( SELECT xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx FROM ##xxxxxxxxxx AS x ) --endregion
  23. 23. 21 --region (6) xxxxxxxxxxxx (change xxx) --region (6.1) Build xxxxxxxxxxxx Table CREATE TABLE##xxxxxxxxxxxxx ( xxxxxxxvarchar(11) ,xxxxchar(4) ,xxxxxxxxxxint ,xxxxxxxxxxxxvarchar(3) ,xxxxxxxxxxxxxxxxxchar(2) not null default '' ,xxxxxxxxxxxxxxxxxx_PREvarchar(4) not null default '' ,xxxxxxxchar(2) not null default '' ,xxxxxxxxxxxxvarchar(4) not null default '' ,xxxxxxxxxxxxxxxxvarchar(6) xxxxxxxxxvarchar(30) ,xxxxxxxxxxxxxvarchar(4) ,xxxxxxxxvarchar(8) ,[xxxxxxxxx] varchar(3) ,[xxxx] varchar(5) not null default '' ,[xxxxxxxxxxxx] varchar(30) ) --endregion --region (6.2) Populate xxxxxxxxxxxxx INSERT INTO ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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