· 9 years ago · Oct 24, 2016, 08:58 AM
1USE [Migration]
2GO
3/****** Object: UserDefinedFunction [dbo].[tkfn_get_file_ext] Script Date: 06/13/2013 09:25:50 ******/
4SET ANSI_NULLS ON
5GO
6SET QUOTED_IDENTIFIER ON
7GO
8-- =============================================
9-- Author: Tikit
10-- Create date: 9 January 2012
11-- Description: Returns the file extension of a file path without the leading dot
12-- =============================================
13CREATE FUNCTION [dbo].[tkfn_get_file_ext]
14(
15 -- Add the parameters for the function here
16 @File varchar(500)
17)
18RETURNS varchar(500)
19AS
20BEGIN
21 -- Declare the return variable here
22 DECLARE @Result varchar(500),
23 @DotPos int,
24 @SlashPos int;
25
26 -- Add the T-SQL statements to compute the return value here
27 SELECT @DotPos = PATINDEX('%.%', REVERSE(@File)) - 1;
28 select @SlashPos = PATINDEX('%\%', REVERSE(@File)) - 1;
29
30 if (@DotPos < 1 or (@DotPos > @SlashPos and @SlashPos > -1))
31 select @Result = ''
32 else
33 select @Result = RIGHT(@File, @DotPos);
34
35 -- Return the result of the function
36 RETURN @Result
37END
38GO
39/****** Object: Table [dbo].[import_files_hold_8] Script Date: 06/13/2013 09:25:48 ******/
40SET ANSI_NULLS ON
41GO
42SET QUOTED_IDENTIFIER ON
43GO
44SET ANSI_PADDING ON
45GO
46CREATE TABLE [dbo].[import_files_hold_8](
47 [UID] [int] IDENTITY(1,1) NOT NULL,
48 [FILEPATH] [nvarchar](450) NULL,
49 [FILENAME] [nvarchar](450) NULL,
50 [OPERATOR] [varchar](32) NULL,
51 [APPLICATION] [varchar](32) NULL,
52 [EDITWHEN] [datetime] NULL,
53 [ENTRYWHEN] [datetime] NULL,
54 [MIGRATION] [varchar](20) NULL,
55 [SCANTYPE] [varchar](20) NULL,
56 [STATUS] [varchar](20) NULL,
57 [LIBRARY] [varchar](100) NULL,
58 [EXCEL_LINKED] [char](1) NULL,
59 [SOURCE_SERVER] [varchar](20) NULL,
60 [CUSTOM_PROPERTY1] [varchar](255) NULL,
61 [CUSTOM_PROPERTY2] [varchar](255) NULL,
62 [CUSTOM_PROPERTY3] [varchar](255) NULL,
63 [BASELEVELFOLDER] [varchar](100) NULL,
64 [WORKSPACENAME] [varchar](100) NULL,
65 [INITIALFOLDER] [varchar](150) NULL,
66 [CLIENT] [varchar](32) NULL,
67 [MATTER] [varchar](32) NULL,
68 [MSG_FROM] [varchar](96) NULL,
69 [MSG_TO] [varchar](96) NULL,
70 [MSG_CC] [varchar](96) NULL,
71 [MSG_SENT] [datetime] NULL,
72 [MSG_RECEIVED] [datetime] NULL,
73 [HAS_ATTACHMENT] [char](1) NULL,
74 [MSG_ID] [varchar](512) NULL
75) ON [PRIMARY]
76GO
77SET ANSI_PADDING OFF
78GO
79/****** Object: Table [dbo].[import_files_hold_7] Script Date: 06/13/2013 09:25:48 ******/
80SET ANSI_NULLS ON
81GO
82SET QUOTED_IDENTIFIER ON
83GO
84SET ANSI_PADDING ON
85GO
86CREATE TABLE [dbo].[import_files_hold_7](
87 [UID] [int] IDENTITY(1,1) NOT NULL,
88 [FILEPATH] [nvarchar](450) NULL,
89 [FILENAME] [nvarchar](450) NULL,
90 [OPERATOR] [varchar](32) NULL,
91 [APPLICATION] [varchar](32) NULL,
92 [EDITWHEN] [datetime] NULL,
93 [ENTRYWHEN] [datetime] NULL,
94 [MIGRATION] [varchar](20) NULL,
95 [SCANTYPE] [varchar](20) NULL,
96 [STATUS] [varchar](20) NULL,
97 [LIBRARY] [varchar](100) NULL,
98 [EXCEL_LINKED] [char](1) NULL,
99 [SOURCE_SERVER] [varchar](20) NULL,
100 [CUSTOM_PROPERTY1] [varchar](255) NULL,
101 [CUSTOM_PROPERTY2] [varchar](255) NULL,
102 [CUSTOM_PROPERTY3] [varchar](255) NULL,
103 [BASELEVELFOLDER] [varchar](100) NULL,
104 [WORKSPACENAME] [varchar](100) NULL,
105 [INITIALFOLDER] [varchar](150) NULL,
106 [CLIENT] [varchar](32) NULL,
107 [MATTER] [varchar](32) NULL,
108 [MSG_FROM] [varchar](96) NULL,
109 [MSG_TO] [varchar](96) NULL,
110 [MSG_CC] [varchar](96) NULL,
111 [MSG_SENT] [datetime] NULL,
112 [MSG_RECEIVED] [datetime] NULL,
113 [HAS_ATTACHMENT] [char](1) NULL,
114 [MSG_ID] [varchar](512) NULL
115) ON [PRIMARY]
116GO
117SET ANSI_PADDING OFF
118GO
119/****** Object: Table [dbo].[import_files_hold_6] Script Date: 06/13/2013 09:25:48 ******/
120SET ANSI_NULLS ON
121GO
122SET QUOTED_IDENTIFIER ON
123GO
124SET ANSI_PADDING ON
125GO
126CREATE TABLE [dbo].[import_files_hold_6](
127 [UID] [int] IDENTITY(1,1) NOT NULL,
128 [FILEPATH] [nvarchar](450) NULL,
129 [FILENAME] [nvarchar](450) NULL,
130 [OPERATOR] [varchar](32) NULL,
131 [APPLICATION] [varchar](32) NULL,
132 [EDITWHEN] [datetime] NULL,
133 [ENTRYWHEN] [datetime] NULL,
134 [MIGRATION] [varchar](20) NULL,
135 [SCANTYPE] [varchar](20) NULL,
136 [STATUS] [varchar](20) NULL,
137 [LIBRARY] [varchar](100) NULL,
138 [EXCEL_LINKED] [char](1) NULL,
139 [SOURCE_SERVER] [varchar](20) NULL,
140 [CUSTOM_PROPERTY1] [varchar](255) NULL,
141 [CUSTOM_PROPERTY2] [varchar](255) NULL,
142 [CUSTOM_PROPERTY3] [varchar](255) NULL,
143 [BASELEVELFOLDER] [varchar](100) NULL,
144 [WORKSPACENAME] [varchar](100) NULL,
145 [INITIALFOLDER] [varchar](150) NULL,
146 [CLIENT] [varchar](32) NULL,
147 [MATTER] [varchar](32) NULL,
148 [MSG_FROM] [varchar](96) NULL,
149 [MSG_TO] [varchar](96) NULL,
150 [MSG_CC] [varchar](96) NULL,
151 [MSG_SENT] [datetime] NULL,
152 [MSG_RECEIVED] [datetime] NULL,
153 [HAS_ATTACHMENT] [char](1) NULL,
154 [MSG_ID] [varchar](512) NULL
155) ON [PRIMARY]
156GO
157SET ANSI_PADDING OFF
158GO
159/****** Object: Table [dbo].[import_files_hold_5] Script Date: 06/13/2013 09:25:48 ******/
160SET ANSI_NULLS ON
161GO
162SET QUOTED_IDENTIFIER ON
163GO
164SET ANSI_PADDING ON
165GO
166CREATE TABLE [dbo].[import_files_hold_5](
167 [UID] [int] IDENTITY(1,1) NOT NULL,
168 [FILEPATH] [nvarchar](450) NULL,
169 [FILENAME] [nvarchar](450) NULL,
170 [OPERATOR] [varchar](32) NULL,
171 [APPLICATION] [varchar](32) NULL,
172 [EDITWHEN] [datetime] NULL,
173 [ENTRYWHEN] [datetime] NULL,
174 [MIGRATION] [varchar](20) NULL,
175 [SCANTYPE] [varchar](20) NULL,
176 [STATUS] [varchar](20) NULL,
177 [LIBRARY] [varchar](100) NULL,
178 [EXCEL_LINKED] [char](1) NULL,
179 [SOURCE_SERVER] [varchar](20) NULL,
180 [CUSTOM_PROPERTY1] [varchar](255) NULL,
181 [CUSTOM_PROPERTY2] [varchar](255) NULL,
182 [CUSTOM_PROPERTY3] [varchar](255) NULL,
183 [BASELEVELFOLDER] [varchar](100) NULL,
184 [WORKSPACENAME] [varchar](100) NULL,
185 [INITIALFOLDER] [varchar](150) NULL,
186 [CLIENT] [varchar](32) NULL,
187 [MATTER] [varchar](32) NULL,
188 [MSG_FROM] [varchar](96) NULL,
189 [MSG_TO] [varchar](96) NULL,
190 [MSG_CC] [varchar](96) NULL,
191 [MSG_SENT] [datetime] NULL,
192 [MSG_RECEIVED] [datetime] NULL,
193 [HAS_ATTACHMENT] [char](1) NULL,
194 [MSG_ID] [varchar](512) NULL
195) ON [PRIMARY]
196GO
197SET ANSI_PADDING OFF
198GO
199/****** Object: Table [dbo].[import_files_hold_4] Script Date: 06/13/2013 09:25:48 ******/
200SET ANSI_NULLS ON
201GO
202SET QUOTED_IDENTIFIER ON
203GO
204SET ANSI_PADDING ON
205GO
206CREATE TABLE [dbo].[import_files_hold_4](
207 [UID] [int] IDENTITY(1,1) NOT NULL,
208 [FILEPATH] [nvarchar](450) NULL,
209 [FILENAME] [nvarchar](450) NULL,
210 [OPERATOR] [varchar](32) NULL,
211 [APPLICATION] [varchar](32) NULL,
212 [EDITWHEN] [datetime] NULL,
213 [ENTRYWHEN] [datetime] NULL,
214 [MIGRATION] [varchar](20) NULL,
215 [SCANTYPE] [varchar](20) NULL,
216 [STATUS] [varchar](20) NULL,
217 [LIBRARY] [varchar](100) NULL,
218 [EXCEL_LINKED] [char](1) NULL,
219 [SOURCE_SERVER] [varchar](20) NULL,
220 [CUSTOM_PROPERTY1] [varchar](255) NULL,
221 [CUSTOM_PROPERTY2] [varchar](255) NULL,
222 [CUSTOM_PROPERTY3] [varchar](255) NULL,
223 [BASELEVELFOLDER] [varchar](100) NULL,
224 [WORKSPACENAME] [varchar](100) NULL,
225 [INITIALFOLDER] [varchar](150) NULL,
226 [CLIENT] [varchar](32) NULL,
227 [MATTER] [varchar](32) NULL,
228 [MSG_FROM] [varchar](96) NULL,
229 [MSG_TO] [varchar](96) NULL,
230 [MSG_CC] [varchar](96) NULL,
231 [MSG_SENT] [datetime] NULL,
232 [MSG_RECEIVED] [datetime] NULL,
233 [HAS_ATTACHMENT] [char](1) NULL,
234 [MSG_ID] [varchar](512) NULL
235) ON [PRIMARY]
236GO
237SET ANSI_PADDING OFF
238GO
239/****** Object: Table [dbo].[import_files_hold_3] Script Date: 06/13/2013 09:25:48 ******/
240SET ANSI_NULLS ON
241GO
242SET QUOTED_IDENTIFIER ON
243GO
244SET ANSI_PADDING ON
245GO
246CREATE TABLE [dbo].[import_files_hold_3](
247 [UID] [int] IDENTITY(1,1) NOT NULL,
248 [FILEPATH] [nvarchar](450) NULL,
249 [FILENAME] [nvarchar](450) NULL,
250 [OPERATOR] [varchar](32) NULL,
251 [APPLICATION] [varchar](32) NULL,
252 [EDITWHEN] [datetime] NULL,
253 [ENTRYWHEN] [datetime] NULL,
254 [MIGRATION] [varchar](20) NULL,
255 [SCANTYPE] [varchar](20) NULL,
256 [STATUS] [varchar](20) NULL,
257 [LIBRARY] [varchar](100) NULL,
258 [EXCEL_LINKED] [char](1) NULL,
259 [SOURCE_SERVER] [varchar](20) NULL,
260 [CUSTOM_PROPERTY1] [varchar](255) NULL,
261 [CUSTOM_PROPERTY2] [varchar](255) NULL,
262 [CUSTOM_PROPERTY3] [varchar](255) NULL,
263 [BASELEVELFOLDER] [varchar](100) NULL,
264 [WORKSPACENAME] [varchar](100) NULL,
265 [INITIALFOLDER] [varchar](150) NULL,
266 [CLIENT] [varchar](32) NULL,
267 [MATTER] [varchar](32) NULL,
268 [MSG_FROM] [varchar](96) NULL,
269 [MSG_TO] [varchar](96) NULL,
270 [MSG_CC] [varchar](96) NULL,
271 [MSG_SENT] [datetime] NULL,
272 [MSG_RECEIVED] [datetime] NULL,
273 [HAS_ATTACHMENT] [char](1) NULL,
274 [MSG_ID] [varchar](512) NULL
275) ON [PRIMARY]
276GO
277SET ANSI_PADDING OFF
278GO
279/****** Object: Table [dbo].[import_files_hold_2] Script Date: 06/13/2013 09:25:47 ******/
280SET ANSI_NULLS ON
281GO
282SET QUOTED_IDENTIFIER ON
283GO
284SET ANSI_PADDING ON
285GO
286CREATE TABLE [dbo].[import_files_hold_2](
287 [UID] [int] IDENTITY(1,1) NOT NULL,
288 [FILEPATH] [nvarchar](450) NULL,
289 [FILENAME] [nvarchar](450) NULL,
290 [OPERATOR] [varchar](32) NULL,
291 [APPLICATION] [varchar](32) NULL,
292 [EDITWHEN] [datetime] NULL,
293 [ENTRYWHEN] [datetime] NULL,
294 [MIGRATION] [varchar](20) NULL,
295 [SCANTYPE] [varchar](20) NULL,
296 [STATUS] [varchar](20) NULL,
297 [LIBRARY] [varchar](100) NULL,
298 [EXCEL_LINKED] [char](1) NULL,
299 [SOURCE_SERVER] [varchar](20) NULL,
300 [CUSTOM_PROPERTY1] [varchar](255) NULL,
301 [CUSTOM_PROPERTY2] [varchar](255) NULL,
302 [CUSTOM_PROPERTY3] [varchar](255) NULL,
303 [BASELEVELFOLDER] [varchar](100) NULL,
304 [WORKSPACENAME] [varchar](100) NULL,
305 [INITIALFOLDER] [varchar](150) NULL,
306 [CLIENT] [varchar](32) NULL,
307 [MATTER] [varchar](32) NULL,
308 [MSG_FROM] [varchar](96) NULL,
309 [MSG_TO] [varchar](96) NULL,
310 [MSG_CC] [varchar](96) NULL,
311 [MSG_SENT] [datetime] NULL,
312 [MSG_RECEIVED] [datetime] NULL,
313 [HAS_ATTACHMENT] [char](1) NULL,
314 [MSG_ID] [varchar](512) NULL
315) ON [PRIMARY]
316GO
317SET ANSI_PADDING OFF
318GO
319/****** Object: Table [dbo].[import_files_hold_1] Script Date: 06/13/2013 09:25:47 ******/
320SET ANSI_NULLS ON
321GO
322SET QUOTED_IDENTIFIER ON
323GO
324SET ANSI_PADDING ON
325GO
326CREATE TABLE [dbo].[import_files_hold_1](
327 [UID] [int] IDENTITY(1,1) NOT NULL,
328 [FILEPATH] [nvarchar](450) NULL,
329 [FILENAME] [nvarchar](450) NULL,
330 [OPERATOR] [varchar](32) NULL,
331 [APPLICATION] [varchar](32) NULL,
332 [EDITWHEN] [datetime] NULL,
333 [ENTRYWHEN] [datetime] NULL,
334 [MIGRATION] [varchar](20) NULL,
335 [SCANTYPE] [varchar](20) NULL,
336 [STATUS] [varchar](20) NULL,
337 [LIBRARY] [varchar](100) NULL,
338 [EXCEL_LINKED] [char](1) NULL,
339 [SOURCE_SERVER] [varchar](20) NULL,
340 [CUSTOM_PROPERTY1] [varchar](255) NULL,
341 [CUSTOM_PROPERTY2] [varchar](255) NULL,
342 [CUSTOM_PROPERTY3] [varchar](255) NULL,
343 [BASELEVELFOLDER] [varchar](100) NULL,
344 [WORKSPACENAME] [varchar](100) NULL,
345 [INITIALFOLDER] [varchar](150) NULL,
346 [CLIENT] [varchar](32) NULL,
347 [MATTER] [varchar](32) NULL,
348 [MSG_FROM] [varchar](96) NULL,
349 [MSG_TO] [varchar](96) NULL,
350 [MSG_CC] [varchar](96) NULL,
351 [MSG_SENT] [datetime] NULL,
352 [MSG_RECEIVED] [datetime] NULL,
353 [HAS_ATTACHMENT] [char](1) NULL,
354 [MSG_ID] [varchar](512) NULL
355) ON [PRIMARY]
356GO
357SET ANSI_PADDING OFF
358GO
359/****** Object: Table [dbo].[tktb_process_log] Script Date: 06/13/2013 09:25:48 ******/
360SET ANSI_NULLS ON
361GO
362SET QUOTED_IDENTIFIER ON
363GO
364SET ANSI_PADDING ON
365GO
366CREATE TABLE [dbo].[tktb_process_log](
367 [log_idx] [int] IDENTITY(1,1) NOT NULL,
368 [log_utc_added] [datetime] NOT NULL,
369 [log_host_name] [nvarchar](64) NOT NULL,
370 [log_app_name] [nvarchar](64) NOT NULL,
371 [log_process] [int] NOT NULL,
372 [log_event_type] [int] NOT NULL,
373 [log_reference] [char](30) NOT NULL,
374 [log_message] [nvarchar](1024) NOT NULL,
375 CONSTRAINT [tktb_process_log_matters_p] PRIMARY KEY CLUSTERED
376(
377 [log_idx] ASC
378)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
379) ON [PRIMARY]
380GO
381SET ANSI_PADDING OFF
382GO
383/****** Object: Table [dbo].[tktb_import_doc_security] Script Date: 06/13/2013 09:25:48 ******/
384SET ANSI_NULLS ON
385GO
386SET QUOTED_IDENTIFIER ON
387GO
388SET ANSI_PADDING ON
389GO
390CREATE TABLE [dbo].[tktb_import_doc_security](
391 [import_id] [int] NOT NULL,
392 [security_id] [int] IDENTITY(1,1) NOT NULL,
393 [object_type] [char](1) NOT NULL,
394 [object_id] [varchar](64) NOT NULL,
395 [access_level] [int] NOT NULL,
396 CONSTRAINT [tktb_import_doc_security_matters_p] PRIMARY KEY CLUSTERED
397(
398 [import_id] ASC,
399 [security_id] ASC
400)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
401) ON [PRIMARY]
402GO
403SET ANSI_PADDING OFF
404GO
405/****** Object: Table [dbo].[tktb_import_doc_profile] Script Date: 06/13/2013 09:25:48 ******/
406SET ANSI_NULLS ON
407GO
408SET QUOTED_IDENTIFIER ON
409GO
410SET ANSI_PADDING ON
411GO
412CREATE TABLE [dbo].[tktb_import_doc_profile](
413 [import_id] [int] IDENTITY(1,1) NOT NULL,
414 [mail_storeid] [nvarchar](256) NULL,
415 [mail_itemid] [nvarchar](256) NULL,
416 [file_path] [nvarchar](300) NULL,
417 [file_name] [nvarchar](300) NULL,
418 [import_flag] [char](1) NOT NULL,
419 [import_flag_utc_date] [datetime] NULL,
420 [import_status] [char](1) NOT NULL,
421 [import_status_utc_date] [datetime] NULL,
422 [folder_flag] [char](1) NOT NULL,
423 [folder_flag_utc_date] [datetime] NULL,
424 [folder_status] [char](1) NOT NULL,
425 [folder_status_utc_date] [datetime] NULL,
426 [folder_metadata_flag] [char](1) NOT NULL,
427 [folder_metadata_flag_utc_date] [datetime] NULL,
428 [folder_security_flag] [char](1) NOT NULL,
429 [folder_security_flag_utc_date] [datetime] NULL,
430 [process_status] [char](1) NOT NULL,
431 [process_status_utc_date] [datetime] NULL,
432 [folder_database] [varchar](64) NULL,
433 [workspace_id] [float] NULL,
434 [folder_id] [float] NULL,
435 [folder_path] [varchar](512) NULL,
436 [document_database] [varchar](64) NULL,
437 [document_number] [float] NULL,
438 [document_version] [int] NULL,
439 [docname] [varchar](254) NULL,
440 [entrywhen] [datetime] NULL,
441 [editwhen] [datetime] NULL,
442 [editprofilewhen] [datetime] NULL,
443 [declarewhen] [datetime] NULL,
444 [author] [varchar](64) NULL,
445 [operator] [varchar](64) NULL,
446 [comments] [varchar](max) NULL,
447 [type] [varchar](32) NULL,
448 [subtype] [char](1) NULL,
449 [class] [varchar](32) NULL,
450 [subclass] [varchar](32) NULL,
451 [archived] [char](1) NULL,
452 [markedforarchive] [char](1) NULL,
453 [frozen] [char](1) NULL,
454 [hasattachment] [char](1) NULL,
455 [retaindays] [int] NULL,
456 [lastuser] [varchar](64) NULL,
457 [extension] [varchar](32) NULL,
458 [messageid] [varchar](512) NULL,
459 [custom1] [varchar](32) NULL,
460 [custom2] [varchar](32) NULL,
461 [custom3] [varchar](32) NULL,
462 [custom4] [varchar](32) NULL,
463 [custom5] [varchar](32) NULL,
464 [custom6] [varchar](32) NULL,
465 [custom7] [varchar](32) NULL,
466 [custom8] [varchar](32) NULL,
467 [custom9] [varchar](32) NULL,
468 [custom10] [varchar](32) NULL,
469 [custom11] [varchar](32) NULL,
470 [custom12] [varchar](32) NULL,
471 [custom13] [varchar](96) NULL,
472 [custom14] [varchar](96) NULL,
473 [custom15] [varchar](96) NULL,
474 [custom16] [varchar](96) NULL,
475 [custom17] [float] NULL,
476 [custom18] [float] NULL,
477 [custom19] [float] NULL,
478 [custom20] [float] NULL,
479 [custom21] [datetime] NULL,
480 [custom22] [datetime] NULL,
481 [custom23] [datetime] NULL,
482 [custom24] [datetime] NULL,
483 [custom25] [char](1) NULL,
484 [custom26] [char](1) NULL,
485 [custom27] [char](1) NULL,
486 [custom28] [char](1) NULL,
487 [custom29] [varchar](32) NULL,
488 [custom30] [varchar](32) NULL,
489 [custom31] [varchar](32) NULL,
490 [default_security] [char](1) NULL,
491 CONSTRAINT [tktb_import_doc_profile_matter_p] PRIMARY KEY CLUSTERED
492(
493 [import_id] ASC
494)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
495) ON [PRIMARY]
496GO
497SET ANSI_PADDING OFF
498GO
499/****** Object: StoredProcedure [dbo].[tksp_show_import_status] Script Date: 06/13/2013 09:25:49 ******/
500SET ANSI_NULLS ON
501GO
502SET QUOTED_IDENTIFIER ON
503GO
504CREATE proc [dbo].[tksp_show_import_status] @import_id bigint = 0
505as
506-- check import status
507select
508'1' engine,
509case import_flag
510 when 'P' then
511 case import_status
512 when 'C' then 'Update Complete'
513 when 'N' then
514 case process_status
515 when 'N' then 'Waiting to update'
516 when 'Y' then 'Batched for Updating'
517 when 'C' then 'Failed to update'
518 end
519 end
520 when 'Z' then 'Not to be Reconciled'
521 when 'R' then
522 case import_status
523 when 'C' then 'Reconcile Complete'
524 when 'N' then 'To be reconciled'
525 when 'E' then 'Error Reconciling'
526 end
527 when 'N' then 'Not to be imported'
528 when 'Y' then
529 case import_status
530 when 'C' then '_Imported'
531 when 'E' then 'Error Importing'
532 when 'N' then
533 case process_status
534 when 'N' then 'To be imported'
535 when 'Y' then 'Batched for import'
536 when 'C' then 'Not Provisioned'
537 end
538 end
539end [Status], count(import_status)
540from tktb_import_doc_profile with (nolock)
541where import_id > @import_id
542group by
543case import_flag
544 when 'P' then
545 case import_status
546 when 'C' then 'Update Complete'
547 when 'N' then
548 case process_status
549 when 'N' then 'Waiting to update'
550 when 'Y' then 'Batched for Updating'
551 when 'C' then 'Failed to update'
552 end
553 end
554 when 'Z' then 'Not to be Reconciled'
555 when 'R' then
556 case import_status
557 when 'C' then 'Reconcile Complete'
558 when 'N' then 'To be reconciled'
559 when 'E' then 'Error Reconciling'
560 end
561 when 'N' then 'Not to be imported'
562 when 'Y' then
563 case import_status
564 when 'C' then '_Imported'
565 when 'E' then 'Error Importing'
566 when 'N' then
567 case process_status
568 when 'N' then 'To be imported'
569 when 'Y' then 'Batched for import'
570 when 'C' then 'Not Provisioned'
571 end
572 end
573end
574
575order by
576case import_flag
577 when 'P' then
578 case import_status
579 when 'C' then 'Update Complete'
580 when 'N' then
581 case process_status
582 when 'N' then 'Waiting to update'
583 when 'Y' then 'Batched for Updating'
584 when 'C' then 'Failed to update'
585 end
586 end
587 when 'Z' then 'Not to be Reconciled'
588 when 'R' then
589 case import_status
590 when 'C' then 'Reconcile Complete'
591 when 'N' then 'To be reconciled'
592 when 'E' then 'Error Reconciling'
593 end
594 when 'N' then 'Not to be imported'
595 when 'Y' then
596 case import_status
597 when 'C' then '_Imported'
598 when 'E' then 'Error Importing'
599 when 'N' then
600 case process_status
601 when 'N' then 'To be imported'
602 when 'Y' then 'Batched for import'
603 when 'C' then 'Not Provisioned'
604 end
605 end
606end
607
608/*
609-- just flags
610select import_flag, import_status,process_status, count(import_status)
611from tktb_import_doc_profile (nolock)
612where import_id > @import_id
613group by import_flag, import_status, process_status
614*/
615GO
616/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_8] Script Date: 06/13/2013 09:25:49 ******/
617SET ANSI_NULLS ON
618GO
619SET QUOTED_IDENTIFIER ON
620GO
621CREATE procedure [dbo].[tksp_import_scanned_documents_8]
622as
623--Insert new records
624PRINT('# of new docs:');
625INSERT INTO [tktb_import_doc_profile]
626(
627 [mail_storeid],
628 [mail_itemid],
629 [file_path],
630 [file_name],
631 [import_flag],
632 [import_flag_utc_date],
633 [import_status],
634 [import_status_utc_date],
635 [folder_flag],
636 [folder_flag_utc_date],
637 [folder_status],
638 [folder_status_utc_date],
639 [folder_metadata_flag],
640 [folder_metadata_flag_utc_date],
641 [folder_security_flag],
642 [folder_security_flag_utc_date],
643 [process_status],
644 [process_status_utc_date],
645 [folder_database],
646 [workspace_id],
647 [folder_id],
648 [folder_path],
649 [document_database],
650 [document_number],
651 [document_version],
652 [docname],
653 [entrywhen],
654 [editwhen],
655 [editprofilewhen],
656 [declarewhen],
657 [author],
658 [operator],
659 [comments],
660 [type],
661 [subtype],
662 [class],
663 [subclass],
664 [archived],
665 [markedforarchive],
666 [frozen],
667 [hasattachment],
668 [retaindays],
669 [lastuser],
670 [extension],
671 [messageid],
672 [custom1],
673 [custom2],
674 [custom3],
675 [custom4],
676 [custom5],
677 [custom6],
678 [custom7],
679 [custom8],
680 [custom9],
681 [custom10],
682 [custom11],
683 [custom12],
684 [custom13],
685 [custom14],
686 [custom15],
687 [custom16],
688 [custom17],
689 [custom18],
690 [custom19],
691 [custom20],
692 [custom21],
693 [custom22],
694 [custom23],
695 [custom24],
696 [custom25],
697 [custom26],
698 [custom27],
699 [custom28],
700 [custom29],
701 [custom30],
702 [custom31],
703 [default_security]
704)
705SELECT
706 null as [mail_storeid],
707 null as [mail_itemid],
708 s.filepath as [file_path],
709 s.filename as [file_name],
710 'N' as [import_flag],
711 null as [import_flag_utc_date],
712 'N' as [import_status],
713 null as [import_status_utc_date],
714 'F' as [folder_flag],
715 null as [folder_flag_utc_date],
716 'N' as [folder_status],
717 null as [folder_status_utc_date],
718 'Y' as [folder_metadata_flag],
719 null as [folder_metadata_flag_utc_date],
720 'Y' as [folder_security_flag],
721 null as [folder_security_flag_utc_date],
722 'N' as [process_status],
723 null as [process_status_utc_date],
724 s.LIBRARY as [folder_database],
725 null as [workspace_id],
726 null as [folder_id],
727 null as [folder_path],
728 s.LIBRARY as [document_database],
729 null as [document_number],
730 null as [document_version],
731 s.FILENAME as [docname],
732 s.ENTRYWHEN as [entrywhen],
733 s.EDITWHEN as [editwhen],
734 null as [editprofilewhen],
735 null as [declarewhen],
736 null as [author],
737 null as [operator],
738 s.FILEPATH as [comments],
739 s.APPLICATION as [type],
740 'D' as [subtype],
741 null as [class],
742 null as [subclass],
743 null as [archived],
744 null as [markedforarchive],
745 null as [frozen],
746 null as [hasattachment],
747 null as [retaindays],
748 null as [lastuser],
749 null as [extension],
750 null as [messageid],
751 s.client as [custom1],
752 s.matter as [custom2],
753 null as [custom3],
754 null as [custom4],
755 null as [custom5],
756 null as [custom6],
757 null as [custom7],
758 null as [custom8],
759 null as [custom9],
760 null as [custom10],
761 null as [custom11],
762 null as [custom12],
763 null as [custom13],
764 null as [custom14],
765 null as [custom15],
766 null as [custom16],
767 null as [custom17],
768 null as [custom18],
769 null as [custom19],
770 null as [custom20],
771 null as [custom21],
772 null as [custom22],
773 null as [custom23],
774 null as [custom24],
775 null as [custom25],
776 null as [custom26],
777 null as [custom27],
778 null as [custom28],
779 null as [custom29],
780 null as [custom30],
781 null as [custom31],
782 'P' as [default_security]
783FROM import_files_hold_8 s
784LEFT OUTER JOIN dbo.tktb_import_doc_profile p
785ON
786 p.file_path = s.filepath
787where
788 p.import_id is null
789
790-- Set to reconcile where newer document exists.
791PRINT('# of reconciles:');
792Update t
793SET
794 import_flag =
795 CASE
796 WHEN t.import_status = 'C' THEN 'R'
797 ELSE t.import_flag
798 END,
799 import_status = 'N',
800 folder_flag = 'P',
801 folder_status = 'N',
802 folder_metadata_flag = 'N',
803 folder_security_flag = 'Y',
804 process_status = 'N',
805 editwhen = s.editwhen
806from import_files_hold_8 s
807inner join dbo.tktb_import_doc_profile t
808ON
809 t.file_path = s.FILEPATH
810where
811 t.editwhen < s.EDITWHEN
812GO
813/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_7] Script Date: 06/13/2013 09:25:49 ******/
814SET ANSI_NULLS ON
815GO
816SET QUOTED_IDENTIFIER ON
817GO
818CREATE procedure [dbo].[tksp_import_scanned_documents_7]
819as
820--Insert new records
821PRINT('# of new docs:');
822INSERT INTO [tktb_import_doc_profile]
823(
824 [mail_storeid],
825 [mail_itemid],
826 [file_path],
827 [file_name],
828 [import_flag],
829 [import_flag_utc_date],
830 [import_status],
831 [import_status_utc_date],
832 [folder_flag],
833 [folder_flag_utc_date],
834 [folder_status],
835 [folder_status_utc_date],
836 [folder_metadata_flag],
837 [folder_metadata_flag_utc_date],
838 [folder_security_flag],
839 [folder_security_flag_utc_date],
840 [process_status],
841 [process_status_utc_date],
842 [folder_database],
843 [workspace_id],
844 [folder_id],
845 [folder_path],
846 [document_database],
847 [document_number],
848 [document_version],
849 [docname],
850 [entrywhen],
851 [editwhen],
852 [editprofilewhen],
853 [declarewhen],
854 [author],
855 [operator],
856 [comments],
857 [type],
858 [subtype],
859 [class],
860 [subclass],
861 [archived],
862 [markedforarchive],
863 [frozen],
864 [hasattachment],
865 [retaindays],
866 [lastuser],
867 [extension],
868 [messageid],
869 [custom1],
870 [custom2],
871 [custom3],
872 [custom4],
873 [custom5],
874 [custom6],
875 [custom7],
876 [custom8],
877 [custom9],
878 [custom10],
879 [custom11],
880 [custom12],
881 [custom13],
882 [custom14],
883 [custom15],
884 [custom16],
885 [custom17],
886 [custom18],
887 [custom19],
888 [custom20],
889 [custom21],
890 [custom22],
891 [custom23],
892 [custom24],
893 [custom25],
894 [custom26],
895 [custom27],
896 [custom28],
897 [custom29],
898 [custom30],
899 [custom31],
900 [default_security]
901)
902SELECT
903 null as [mail_storeid],
904 null as [mail_itemid],
905 s.filepath as [file_path],
906 s.filename as [file_name],
907 'N' as [import_flag],
908 null as [import_flag_utc_date],
909 'N' as [import_status],
910 null as [import_status_utc_date],
911 'F' as [folder_flag],
912 null as [folder_flag_utc_date],
913 'N' as [folder_status],
914 null as [folder_status_utc_date],
915 'Y' as [folder_metadata_flag],
916 null as [folder_metadata_flag_utc_date],
917 'Y' as [folder_security_flag],
918 null as [folder_security_flag_utc_date],
919 'N' as [process_status],
920 null as [process_status_utc_date],
921 s.LIBRARY as [folder_database],
922 null as [workspace_id],
923 null as [folder_id],
924 null as [folder_path],
925 s.LIBRARY as [document_database],
926 null as [document_number],
927 null as [document_version],
928 s.FILENAME as [docname],
929 s.ENTRYWHEN as [entrywhen],
930 s.EDITWHEN as [editwhen],
931 null as [editprofilewhen],
932 null as [declarewhen],
933 null as [author],
934 null as [operator],
935 s.FILEPATH as [comments],
936 s.APPLICATION as [type],
937 'D' as [subtype],
938 null as [class],
939 null as [subclass],
940 null as [archived],
941 null as [markedforarchive],
942 null as [frozen],
943 null as [hasattachment],
944 null as [retaindays],
945 null as [lastuser],
946 null as [extension],
947 null as [messageid],
948 s.client as [custom1],
949 s.matter as [custom2],
950 null as [custom3],
951 null as [custom4],
952 null as [custom5],
953 null as [custom6],
954 null as [custom7],
955 null as [custom8],
956 null as [custom9],
957 null as [custom10],
958 null as [custom11],
959 null as [custom12],
960 null as [custom13],
961 null as [custom14],
962 null as [custom15],
963 null as [custom16],
964 null as [custom17],
965 null as [custom18],
966 null as [custom19],
967 null as [custom20],
968 null as [custom21],
969 null as [custom22],
970 null as [custom23],
971 null as [custom24],
972 null as [custom25],
973 null as [custom26],
974 null as [custom27],
975 null as [custom28],
976 null as [custom29],
977 null as [custom30],
978 null as [custom31],
979 'P' as [default_security]
980FROM import_files_hold_7 s
981LEFT OUTER JOIN dbo.tktb_import_doc_profile p
982ON
983 p.file_path = s.filepath
984where
985 p.import_id is null
986
987-- Set to reconcile where newer document exists.
988PRINT('# of reconciles:');
989Update t
990SET
991 import_flag =
992 CASE
993 WHEN t.import_status = 'C' THEN 'R'
994 ELSE t.import_flag
995 END,
996 import_status = 'N',
997 folder_flag = 'P',
998 folder_status = 'N',
999 folder_metadata_flag = 'N',
1000 folder_security_flag = 'Y',
1001 process_status = 'N',
1002 editwhen = s.editwhen
1003from import_files_hold_7 s
1004inner join dbo.tktb_import_doc_profile t
1005ON
1006 t.file_path = s.FILEPATH
1007where
1008 t.editwhen < s.EDITWHEN
1009GO
1010/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_6] Script Date: 06/13/2013 09:25:49 ******/
1011SET ANSI_NULLS ON
1012GO
1013SET QUOTED_IDENTIFIER ON
1014GO
1015CREATE procedure [dbo].[tksp_import_scanned_documents_6]
1016as
1017--Insert new records
1018PRINT('# of new docs:');
1019INSERT INTO [tktb_import_doc_profile]
1020(
1021 [mail_storeid],
1022 [mail_itemid],
1023 [file_path],
1024 [file_name],
1025 [import_flag],
1026 [import_flag_utc_date],
1027 [import_status],
1028 [import_status_utc_date],
1029 [folder_flag],
1030 [folder_flag_utc_date],
1031 [folder_status],
1032 [folder_status_utc_date],
1033 [folder_metadata_flag],
1034 [folder_metadata_flag_utc_date],
1035 [folder_security_flag],
1036 [folder_security_flag_utc_date],
1037 [process_status],
1038 [process_status_utc_date],
1039 [folder_database],
1040 [workspace_id],
1041 [folder_id],
1042 [folder_path],
1043 [document_database],
1044 [document_number],
1045 [document_version],
1046 [docname],
1047 [entrywhen],
1048 [editwhen],
1049 [editprofilewhen],
1050 [declarewhen],
1051 [author],
1052 [operator],
1053 [comments],
1054 [type],
1055 [subtype],
1056 [class],
1057 [subclass],
1058 [archived],
1059 [markedforarchive],
1060 [frozen],
1061 [hasattachment],
1062 [retaindays],
1063 [lastuser],
1064 [extension],
1065 [messageid],
1066 [custom1],
1067 [custom2],
1068 [custom3],
1069 [custom4],
1070 [custom5],
1071 [custom6],
1072 [custom7],
1073 [custom8],
1074 [custom9],
1075 [custom10],
1076 [custom11],
1077 [custom12],
1078 [custom13],
1079 [custom14],
1080 [custom15],
1081 [custom16],
1082 [custom17],
1083 [custom18],
1084 [custom19],
1085 [custom20],
1086 [custom21],
1087 [custom22],
1088 [custom23],
1089 [custom24],
1090 [custom25],
1091 [custom26],
1092 [custom27],
1093 [custom28],
1094 [custom29],
1095 [custom30],
1096 [custom31],
1097 [default_security]
1098)
1099SELECT
1100 null as [mail_storeid],
1101 null as [mail_itemid],
1102 s.filepath as [file_path],
1103 s.filename as [file_name],
1104 'N' as [import_flag],
1105 null as [import_flag_utc_date],
1106 'N' as [import_status],
1107 null as [import_status_utc_date],
1108 'F' as [folder_flag],
1109 null as [folder_flag_utc_date],
1110 'N' as [folder_status],
1111 null as [folder_status_utc_date],
1112 'Y' as [folder_metadata_flag],
1113 null as [folder_metadata_flag_utc_date],
1114 'Y' as [folder_security_flag],
1115 null as [folder_security_flag_utc_date],
1116 'N' as [process_status],
1117 null as [process_status_utc_date],
1118 s.LIBRARY as [folder_database],
1119 null as [workspace_id],
1120 null as [folder_id],
1121 null as [folder_path],
1122 s.LIBRARY as [document_database],
1123 null as [document_number],
1124 null as [document_version],
1125 s.FILENAME as [docname],
1126 s.ENTRYWHEN as [entrywhen],
1127 s.EDITWHEN as [editwhen],
1128 null as [editprofilewhen],
1129 null as [declarewhen],
1130 null as [author],
1131 null as [operator],
1132 s.FILEPATH as [comments],
1133 s.APPLICATION as [type],
1134 'D' as [subtype],
1135 null as [class],
1136 null as [subclass],
1137 null as [archived],
1138 null as [markedforarchive],
1139 null as [frozen],
1140 null as [hasattachment],
1141 null as [retaindays],
1142 null as [lastuser],
1143 null as [extension],
1144 null as [messageid],
1145 s.client as [custom1],
1146 s.matter as [custom2],
1147 null as [custom3],
1148 null as [custom4],
1149 null as [custom5],
1150 null as [custom6],
1151 null as [custom7],
1152 null as [custom8],
1153 null as [custom9],
1154 null as [custom10],
1155 null as [custom11],
1156 null as [custom12],
1157 null as [custom13],
1158 null as [custom14],
1159 null as [custom15],
1160 null as [custom16],
1161 null as [custom17],
1162 null as [custom18],
1163 null as [custom19],
1164 null as [custom20],
1165 null as [custom21],
1166 null as [custom22],
1167 null as [custom23],
1168 null as [custom24],
1169 null as [custom25],
1170 null as [custom26],
1171 null as [custom27],
1172 null as [custom28],
1173 null as [custom29],
1174 null as [custom30],
1175 null as [custom31],
1176 'P' as [default_security]
1177FROM import_files_hold_6 s
1178LEFT OUTER JOIN dbo.tktb_import_doc_profile p
1179ON
1180 p.file_path = s.filepath
1181where
1182 p.import_id is null
1183
1184-- Set to reconcile where newer document exists.
1185PRINT('# of reconciles:');
1186Update t
1187SET
1188 import_flag =
1189 CASE
1190 WHEN t.import_status = 'C' THEN 'R'
1191 ELSE t.import_flag
1192 END,
1193 import_status = 'N',
1194 folder_flag = 'P',
1195 folder_status = 'N',
1196 folder_metadata_flag = 'N',
1197 folder_security_flag = 'Y',
1198 process_status = 'N',
1199 editwhen = s.editwhen
1200from import_files_hold_6 s
1201inner join dbo.tktb_import_doc_profile t
1202ON
1203 t.file_path = s.FILEPATH
1204where
1205 t.editwhen < s.EDITWHEN
1206GO
1207/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_5] Script Date: 06/13/2013 09:25:49 ******/
1208SET ANSI_NULLS ON
1209GO
1210SET QUOTED_IDENTIFIER ON
1211GO
1212CREATE procedure [dbo].[tksp_import_scanned_documents_5]
1213as
1214--Insert new records
1215PRINT('# of new docs:');
1216INSERT INTO [tktb_import_doc_profile]
1217(
1218 [mail_storeid],
1219 [mail_itemid],
1220 [file_path],
1221 [file_name],
1222 [import_flag],
1223 [import_flag_utc_date],
1224 [import_status],
1225 [import_status_utc_date],
1226 [folder_flag],
1227 [folder_flag_utc_date],
1228 [folder_status],
1229 [folder_status_utc_date],
1230 [folder_metadata_flag],
1231 [folder_metadata_flag_utc_date],
1232 [folder_security_flag],
1233 [folder_security_flag_utc_date],
1234 [process_status],
1235 [process_status_utc_date],
1236 [folder_database],
1237 [workspace_id],
1238 [folder_id],
1239 [folder_path],
1240 [document_database],
1241 [document_number],
1242 [document_version],
1243 [docname],
1244 [entrywhen],
1245 [editwhen],
1246 [editprofilewhen],
1247 [declarewhen],
1248 [author],
1249 [operator],
1250 [comments],
1251 [type],
1252 [subtype],
1253 [class],
1254 [subclass],
1255 [archived],
1256 [markedforarchive],
1257 [frozen],
1258 [hasattachment],
1259 [retaindays],
1260 [lastuser],
1261 [extension],
1262 [messageid],
1263 [custom1],
1264 [custom2],
1265 [custom3],
1266 [custom4],
1267 [custom5],
1268 [custom6],
1269 [custom7],
1270 [custom8],
1271 [custom9],
1272 [custom10],
1273 [custom11],
1274 [custom12],
1275 [custom13],
1276 [custom14],
1277 [custom15],
1278 [custom16],
1279 [custom17],
1280 [custom18],
1281 [custom19],
1282 [custom20],
1283 [custom21],
1284 [custom22],
1285 [custom23],
1286 [custom24],
1287 [custom25],
1288 [custom26],
1289 [custom27],
1290 [custom28],
1291 [custom29],
1292 [custom30],
1293 [custom31],
1294 [default_security]
1295)
1296SELECT
1297 null as [mail_storeid],
1298 null as [mail_itemid],
1299 s.filepath as [file_path],
1300 s.filename as [file_name],
1301 'N' as [import_flag],
1302 null as [import_flag_utc_date],
1303 'N' as [import_status],
1304 null as [import_status_utc_date],
1305 'F' as [folder_flag],
1306 null as [folder_flag_utc_date],
1307 'N' as [folder_status],
1308 null as [folder_status_utc_date],
1309 'Y' as [folder_metadata_flag],
1310 null as [folder_metadata_flag_utc_date],
1311 'Y' as [folder_security_flag],
1312 null as [folder_security_flag_utc_date],
1313 'N' as [process_status],
1314 null as [process_status_utc_date],
1315 s.LIBRARY as [folder_database],
1316 null as [workspace_id],
1317 null as [folder_id],
1318 null as [folder_path],
1319 s.LIBRARY as [document_database],
1320 null as [document_number],
1321 null as [document_version],
1322 s.FILENAME as [docname],
1323 s.ENTRYWHEN as [entrywhen],
1324 s.EDITWHEN as [editwhen],
1325 null as [editprofilewhen],
1326 null as [declarewhen],
1327 null as [author],
1328 null as [operator],
1329 s.FILEPATH as [comments],
1330 s.APPLICATION as [type],
1331 'D' as [subtype],
1332 null as [class],
1333 null as [subclass],
1334 null as [archived],
1335 null as [markedforarchive],
1336 null as [frozen],
1337 null as [hasattachment],
1338 null as [retaindays],
1339 null as [lastuser],
1340 null as [extension],
1341 null as [messageid],
1342 s.client as [custom1],
1343 s.matter as [custom2],
1344 null as [custom3],
1345 null as [custom4],
1346 null as [custom5],
1347 null as [custom6],
1348 null as [custom7],
1349 null as [custom8],
1350 null as [custom9],
1351 null as [custom10],
1352 null as [custom11],
1353 null as [custom12],
1354 null as [custom13],
1355 null as [custom14],
1356 null as [custom15],
1357 null as [custom16],
1358 null as [custom17],
1359 null as [custom18],
1360 null as [custom19],
1361 null as [custom20],
1362 null as [custom21],
1363 null as [custom22],
1364 null as [custom23],
1365 null as [custom24],
1366 null as [custom25],
1367 null as [custom26],
1368 null as [custom27],
1369 null as [custom28],
1370 null as [custom29],
1371 null as [custom30],
1372 null as [custom31],
1373 'P' as [default_security]
1374FROM import_files_hold_5 s
1375LEFT OUTER JOIN dbo.tktb_import_doc_profile p
1376ON
1377 p.file_path = s.filepath
1378where
1379 p.import_id is null
1380
1381-- Set to reconcile where newer document exists.
1382PRINT('# of reconciles:');
1383Update t
1384SET
1385 import_flag =
1386 CASE
1387 WHEN t.import_status = 'C' THEN 'R'
1388 ELSE t.import_flag
1389 END,
1390 import_status = 'N',
1391 folder_flag = 'P',
1392 folder_status = 'N',
1393 folder_metadata_flag = 'N',
1394 folder_security_flag = 'Y',
1395 process_status = 'N',
1396 editwhen = s.editwhen
1397from import_files_hold_5 s
1398inner join dbo.tktb_import_doc_profile t
1399ON
1400 t.file_path = s.FILEPATH
1401where
1402 t.editwhen < s.EDITWHEN
1403GO
1404/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_4] Script Date: 06/13/2013 09:25:49 ******/
1405SET ANSI_NULLS ON
1406GO
1407SET QUOTED_IDENTIFIER ON
1408GO
1409CREATE procedure [dbo].[tksp_import_scanned_documents_4]
1410as
1411--Insert new records
1412PRINT('# of new docs:');
1413INSERT INTO [tktb_import_doc_profile]
1414(
1415 [mail_storeid],
1416 [mail_itemid],
1417 [file_path],
1418 [file_name],
1419 [import_flag],
1420 [import_flag_utc_date],
1421 [import_status],
1422 [import_status_utc_date],
1423 [folder_flag],
1424 [folder_flag_utc_date],
1425 [folder_status],
1426 [folder_status_utc_date],
1427 [folder_metadata_flag],
1428 [folder_metadata_flag_utc_date],
1429 [folder_security_flag],
1430 [folder_security_flag_utc_date],
1431 [process_status],
1432 [process_status_utc_date],
1433 [folder_database],
1434 [workspace_id],
1435 [folder_id],
1436 [folder_path],
1437 [document_database],
1438 [document_number],
1439 [document_version],
1440 [docname],
1441 [entrywhen],
1442 [editwhen],
1443 [editprofilewhen],
1444 [declarewhen],
1445 [author],
1446 [operator],
1447 [comments],
1448 [type],
1449 [subtype],
1450 [class],
1451 [subclass],
1452 [archived],
1453 [markedforarchive],
1454 [frozen],
1455 [hasattachment],
1456 [retaindays],
1457 [lastuser],
1458 [extension],
1459 [messageid],
1460 [custom1],
1461 [custom2],
1462 [custom3],
1463 [custom4],
1464 [custom5],
1465 [custom6],
1466 [custom7],
1467 [custom8],
1468 [custom9],
1469 [custom10],
1470 [custom11],
1471 [custom12],
1472 [custom13],
1473 [custom14],
1474 [custom15],
1475 [custom16],
1476 [custom17],
1477 [custom18],
1478 [custom19],
1479 [custom20],
1480 [custom21],
1481 [custom22],
1482 [custom23],
1483 [custom24],
1484 [custom25],
1485 [custom26],
1486 [custom27],
1487 [custom28],
1488 [custom29],
1489 [custom30],
1490 [custom31],
1491 [default_security]
1492)
1493SELECT
1494 null as [mail_storeid],
1495 null as [mail_itemid],
1496 s.filepath as [file_path],
1497 s.filename as [file_name],
1498 'N' as [import_flag],
1499 null as [import_flag_utc_date],
1500 'N' as [import_status],
1501 null as [import_status_utc_date],
1502 'F' as [folder_flag],
1503 null as [folder_flag_utc_date],
1504 'N' as [folder_status],
1505 null as [folder_status_utc_date],
1506 'Y' as [folder_metadata_flag],
1507 null as [folder_metadata_flag_utc_date],
1508 'Y' as [folder_security_flag],
1509 null as [folder_security_flag_utc_date],
1510 'N' as [process_status],
1511 null as [process_status_utc_date],
1512 s.LIBRARY as [folder_database],
1513 null as [workspace_id],
1514 null as [folder_id],
1515 null as [folder_path],
1516 s.LIBRARY as [document_database],
1517 null as [document_number],
1518 null as [document_version],
1519 s.FILENAME as [docname],
1520 s.ENTRYWHEN as [entrywhen],
1521 s.EDITWHEN as [editwhen],
1522 null as [editprofilewhen],
1523 null as [declarewhen],
1524 null as [author],
1525 null as [operator],
1526 s.FILEPATH as [comments],
1527 s.APPLICATION as [type],
1528 'D' as [subtype],
1529 null as [class],
1530 null as [subclass],
1531 null as [archived],
1532 null as [markedforarchive],
1533 null as [frozen],
1534 null as [hasattachment],
1535 null as [retaindays],
1536 null as [lastuser],
1537 null as [extension],
1538 null as [messageid],
1539 s.client as [custom1],
1540 s.matter as [custom2],
1541 null as [custom3],
1542 null as [custom4],
1543 null as [custom5],
1544 null as [custom6],
1545 null as [custom7],
1546 null as [custom8],
1547 null as [custom9],
1548 null as [custom10],
1549 null as [custom11],
1550 null as [custom12],
1551 null as [custom13],
1552 null as [custom14],
1553 null as [custom15],
1554 null as [custom16],
1555 null as [custom17],
1556 null as [custom18],
1557 null as [custom19],
1558 null as [custom20],
1559 null as [custom21],
1560 null as [custom22],
1561 null as [custom23],
1562 null as [custom24],
1563 null as [custom25],
1564 null as [custom26],
1565 null as [custom27],
1566 null as [custom28],
1567 null as [custom29],
1568 null as [custom30],
1569 null as [custom31],
1570 'P' as [default_security]
1571FROM import_files_hold_4 s
1572LEFT OUTER JOIN dbo.tktb_import_doc_profile p
1573ON
1574 p.file_path = s.filepath
1575where
1576 p.import_id is null
1577
1578-- Set to reconcile where newer document exists.
1579PRINT('# of reconciles:');
1580Update t
1581SET
1582 import_flag =
1583 CASE
1584 WHEN t.import_status = 'C' THEN 'R'
1585 ELSE t.import_flag
1586 END,
1587 import_status = 'N',
1588 folder_flag = 'P',
1589 folder_status = 'N',
1590 folder_metadata_flag = 'N',
1591 folder_security_flag = 'Y',
1592 process_status = 'N',
1593 editwhen = s.editwhen
1594from import_files_hold_4 s
1595inner join dbo.tktb_import_doc_profile t
1596ON
1597 t.file_path = s.FILEPATH
1598where
1599 t.editwhen < s.EDITWHEN
1600GO
1601/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_3] Script Date: 06/13/2013 09:25:49 ******/
1602SET ANSI_NULLS ON
1603GO
1604SET QUOTED_IDENTIFIER ON
1605GO
1606CREATE procedure [dbo].[tksp_import_scanned_documents_3]
1607as
1608--Insert new records
1609PRINT('# of new docs:');
1610INSERT INTO [tktb_import_doc_profile]
1611(
1612 [mail_storeid],
1613 [mail_itemid],
1614 [file_path],
1615 [file_name],
1616 [import_flag],
1617 [import_flag_utc_date],
1618 [import_status],
1619 [import_status_utc_date],
1620 [folder_flag],
1621 [folder_flag_utc_date],
1622 [folder_status],
1623 [folder_status_utc_date],
1624 [folder_metadata_flag],
1625 [folder_metadata_flag_utc_date],
1626 [folder_security_flag],
1627 [folder_security_flag_utc_date],
1628 [process_status],
1629 [process_status_utc_date],
1630 [folder_database],
1631 [workspace_id],
1632 [folder_id],
1633 [folder_path],
1634 [document_database],
1635 [document_number],
1636 [document_version],
1637 [docname],
1638 [entrywhen],
1639 [editwhen],
1640 [editprofilewhen],
1641 [declarewhen],
1642 [author],
1643 [operator],
1644 [comments],
1645 [type],
1646 [subtype],
1647 [class],
1648 [subclass],
1649 [archived],
1650 [markedforarchive],
1651 [frozen],
1652 [hasattachment],
1653 [retaindays],
1654 [lastuser],
1655 [extension],
1656 [messageid],
1657 [custom1],
1658 [custom2],
1659 [custom3],
1660 [custom4],
1661 [custom5],
1662 [custom6],
1663 [custom7],
1664 [custom8],
1665 [custom9],
1666 [custom10],
1667 [custom11],
1668 [custom12],
1669 [custom13],
1670 [custom14],
1671 [custom15],
1672 [custom16],
1673 [custom17],
1674 [custom18],
1675 [custom19],
1676 [custom20],
1677 [custom21],
1678 [custom22],
1679 [custom23],
1680 [custom24],
1681 [custom25],
1682 [custom26],
1683 [custom27],
1684 [custom28],
1685 [custom29],
1686 [custom30],
1687 [custom31],
1688 [default_security]
1689)
1690SELECT
1691 null as [mail_storeid],
1692 null as [mail_itemid],
1693 s.filepath as [file_path],
1694 s.filename as [file_name],
1695 'N' as [import_flag],
1696 null as [import_flag_utc_date],
1697 'N' as [import_status],
1698 null as [import_status_utc_date],
1699 'F' as [folder_flag],
1700 null as [folder_flag_utc_date],
1701 'N' as [folder_status],
1702 null as [folder_status_utc_date],
1703 'Y' as [folder_metadata_flag],
1704 null as [folder_metadata_flag_utc_date],
1705 'Y' as [folder_security_flag],
1706 null as [folder_security_flag_utc_date],
1707 'N' as [process_status],
1708 null as [process_status_utc_date],
1709 s.LIBRARY as [folder_database],
1710 null as [workspace_id],
1711 null as [folder_id],
1712 null as [folder_path],
1713 s.LIBRARY as [document_database],
1714 null as [document_number],
1715 null as [document_version],
1716 s.FILENAME as [docname],
1717 s.ENTRYWHEN as [entrywhen],
1718 s.EDITWHEN as [editwhen],
1719 null as [editprofilewhen],
1720 null as [declarewhen],
1721 null as [author],
1722 null as [operator],
1723 s.FILEPATH as [comments],
1724 s.APPLICATION as [type],
1725 'D' as [subtype],
1726 null as [class],
1727 null as [subclass],
1728 null as [archived],
1729 null as [markedforarchive],
1730 null as [frozen],
1731 null as [hasattachment],
1732 null as [retaindays],
1733 null as [lastuser],
1734 null as [extension],
1735 null as [messageid],
1736 s.client as [custom1],
1737 s.matter as [custom2],
1738 null as [custom3],
1739 null as [custom4],
1740 null as [custom5],
1741 null as [custom6],
1742 null as [custom7],
1743 null as [custom8],
1744 null as [custom9],
1745 null as [custom10],
1746 null as [custom11],
1747 null as [custom12],
1748 null as [custom13],
1749 null as [custom14],
1750 null as [custom15],
1751 null as [custom16],
1752 null as [custom17],
1753 null as [custom18],
1754 null as [custom19],
1755 null as [custom20],
1756 null as [custom21],
1757 null as [custom22],
1758 null as [custom23],
1759 null as [custom24],
1760 null as [custom25],
1761 null as [custom26],
1762 null as [custom27],
1763 null as [custom28],
1764 null as [custom29],
1765 null as [custom30],
1766 null as [custom31],
1767 'P' as [default_security]
1768FROM import_files_hold_3 s
1769LEFT OUTER JOIN dbo.tktb_import_doc_profile p
1770ON
1771 p.file_path = s.filepath
1772where
1773 p.import_id is null
1774
1775-- Set to reconcile where newer document exists.
1776PRINT('# of reconciles:');
1777Update t
1778SET
1779 import_flag =
1780 CASE
1781 WHEN t.import_status = 'C' THEN 'R'
1782 ELSE t.import_flag
1783 END,
1784 import_status = 'N',
1785 folder_flag = 'P',
1786 folder_status = 'N',
1787 folder_metadata_flag = 'N',
1788 folder_security_flag = 'Y',
1789 process_status = 'N',
1790 editwhen = s.editwhen
1791from import_files_hold_3 s
1792inner join dbo.tktb_import_doc_profile t
1793ON
1794 t.file_path = s.FILEPATH
1795where
1796 t.editwhen < s.EDITWHEN
1797GO
1798/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_2] Script Date: 06/13/2013 09:25:49 ******/
1799SET ANSI_NULLS ON
1800GO
1801SET QUOTED_IDENTIFIER ON
1802GO
1803CREATE procedure [dbo].[tksp_import_scanned_documents_2]
1804as
1805--Insert new records
1806PRINT('# of new docs:');
1807INSERT INTO [tktb_import_doc_profile]
1808(
1809 [mail_storeid],
1810 [mail_itemid],
1811 [file_path],
1812 [file_name],
1813 [import_flag],
1814 [import_flag_utc_date],
1815 [import_status],
1816 [import_status_utc_date],
1817 [folder_flag],
1818 [folder_flag_utc_date],
1819 [folder_status],
1820 [folder_status_utc_date],
1821 [folder_metadata_flag],
1822 [folder_metadata_flag_utc_date],
1823 [folder_security_flag],
1824 [folder_security_flag_utc_date],
1825 [process_status],
1826 [process_status_utc_date],
1827 [folder_database],
1828 [workspace_id],
1829 [folder_id],
1830 [folder_path],
1831 [document_database],
1832 [document_number],
1833 [document_version],
1834 [docname],
1835 [entrywhen],
1836 [editwhen],
1837 [editprofilewhen],
1838 [declarewhen],
1839 [author],
1840 [operator],
1841 [comments],
1842 [type],
1843 [subtype],
1844 [class],
1845 [subclass],
1846 [archived],
1847 [markedforarchive],
1848 [frozen],
1849 [hasattachment],
1850 [retaindays],
1851 [lastuser],
1852 [extension],
1853 [messageid],
1854 [custom1],
1855 [custom2],
1856 [custom3],
1857 [custom4],
1858 [custom5],
1859 [custom6],
1860 [custom7],
1861 [custom8],
1862 [custom9],
1863 [custom10],
1864 [custom11],
1865 [custom12],
1866 [custom13],
1867 [custom14],
1868 [custom15],
1869 [custom16],
1870 [custom17],
1871 [custom18],
1872 [custom19],
1873 [custom20],
1874 [custom21],
1875 [custom22],
1876 [custom23],
1877 [custom24],
1878 [custom25],
1879 [custom26],
1880 [custom27],
1881 [custom28],
1882 [custom29],
1883 [custom30],
1884 [custom31],
1885 [default_security]
1886)
1887SELECT
1888 null as [mail_storeid],
1889 null as [mail_itemid],
1890 s.filepath as [file_path],
1891 s.filename as [file_name],
1892 'N' as [import_flag],
1893 null as [import_flag_utc_date],
1894 'N' as [import_status],
1895 null as [import_status_utc_date],
1896 'F' as [folder_flag],
1897 null as [folder_flag_utc_date],
1898 'N' as [folder_status],
1899 null as [folder_status_utc_date],
1900 'Y' as [folder_metadata_flag],
1901 null as [folder_metadata_flag_utc_date],
1902 'Y' as [folder_security_flag],
1903 null as [folder_security_flag_utc_date],
1904 'N' as [process_status],
1905 null as [process_status_utc_date],
1906 s.LIBRARY as [folder_database],
1907 null as [workspace_id],
1908 null as [folder_id],
1909 null as [folder_path],
1910 s.LIBRARY as [document_database],
1911 null as [document_number],
1912 null as [document_version],
1913 s.FILENAME as [docname],
1914 s.ENTRYWHEN as [entrywhen],
1915 s.EDITWHEN as [editwhen],
1916 null as [editprofilewhen],
1917 null as [declarewhen],
1918 null as [author],
1919 null as [operator],
1920 s.FILEPATH as [comments],
1921 s.APPLICATION as [type],
1922 'D' as [subtype],
1923 null as [class],
1924 null as [subclass],
1925 null as [archived],
1926 null as [markedforarchive],
1927 null as [frozen],
1928 null as [hasattachment],
1929 null as [retaindays],
1930 null as [lastuser],
1931 null as [extension],
1932 null as [messageid],
1933 s.client as [custom1],
1934 s.matter as [custom2],
1935 null as [custom3],
1936 null as [custom4],
1937 null as [custom5],
1938 null as [custom6],
1939 null as [custom7],
1940 null as [custom8],
1941 null as [custom9],
1942 null as [custom10],
1943 null as [custom11],
1944 null as [custom12],
1945 null as [custom13],
1946 null as [custom14],
1947 null as [custom15],
1948 null as [custom16],
1949 null as [custom17],
1950 null as [custom18],
1951 null as [custom19],
1952 null as [custom20],
1953 null as [custom21],
1954 null as [custom22],
1955 null as [custom23],
1956 null as [custom24],
1957 null as [custom25],
1958 null as [custom26],
1959 null as [custom27],
1960 null as [custom28],
1961 null as [custom29],
1962 null as [custom30],
1963 null as [custom31],
1964 'P' as [default_security]
1965FROM import_files_hold_2 s
1966LEFT OUTER JOIN dbo.tktb_import_doc_profile p
1967ON
1968 p.file_path = s.filepath
1969where
1970 p.import_id is null
1971
1972-- Set to reconcile where newer document exists.
1973PRINT('# of reconciles:');
1974Update t
1975SET
1976 import_flag =
1977 CASE
1978 WHEN t.import_status = 'C' THEN 'R'
1979 ELSE t.import_flag
1980 END,
1981 import_status = 'N',
1982 folder_flag = 'P',
1983 folder_status = 'N',
1984 folder_metadata_flag = 'N',
1985 folder_security_flag = 'Y',
1986 process_status = 'N',
1987 editwhen = s.editwhen
1988from import_files_hold_2 s
1989inner join dbo.tktb_import_doc_profile t
1990ON
1991 t.file_path = s.FILEPATH
1992where
1993 t.editwhen < s.EDITWHEN
1994GO
1995/****** Object: StoredProcedure [dbo].[tksp_import_scanned_documents_1] Script Date: 06/13/2013 09:25:49 ******/
1996SET ANSI_NULLS ON
1997GO
1998SET QUOTED_IDENTIFIER ON
1999GO
2000CREATE procedure [dbo].[tksp_import_scanned_documents_1]
2001as
2002--Insert new records
2003PRINT('# of new docs:');
2004INSERT INTO [tktb_import_doc_profile]
2005(
2006 [mail_storeid],
2007 [mail_itemid],
2008 [file_path],
2009 [file_name],
2010 [import_flag],
2011 [import_flag_utc_date],
2012 [import_status],
2013 [import_status_utc_date],
2014 [folder_flag],
2015 [folder_flag_utc_date],
2016 [folder_status],
2017 [folder_status_utc_date],
2018 [folder_metadata_flag],
2019 [folder_metadata_flag_utc_date],
2020 [folder_security_flag],
2021 [folder_security_flag_utc_date],
2022 [process_status],
2023 [process_status_utc_date],
2024 [folder_database],
2025 [workspace_id],
2026 [folder_id],
2027 [folder_path],
2028 [document_database],
2029 [document_number],
2030 [document_version],
2031 [docname],
2032 [entrywhen],
2033 [editwhen],
2034 [editprofilewhen],
2035 [declarewhen],
2036 [author],
2037 [operator],
2038 [comments],
2039 [type],
2040 [subtype],
2041 [class],
2042 [subclass],
2043 [archived],
2044 [markedforarchive],
2045 [frozen],
2046 [hasattachment],
2047 [retaindays],
2048 [lastuser],
2049 [extension],
2050 [messageid],
2051 [custom1],
2052 [custom2],
2053 [custom3],
2054 [custom4],
2055 [custom5],
2056 [custom6],
2057 [custom7],
2058 [custom8],
2059 [custom9],
2060 [custom10],
2061 [custom11],
2062 [custom12],
2063 [custom13],
2064 [custom14],
2065 [custom15],
2066 [custom16],
2067 [custom17],
2068 [custom18],
2069 [custom19],
2070 [custom20],
2071 [custom21],
2072 [custom22],
2073 [custom23],
2074 [custom24],
2075 [custom25],
2076 [custom26],
2077 [custom27],
2078 [custom28],
2079 [custom29],
2080 [custom30],
2081 [custom31],
2082 [default_security]
2083)
2084SELECT
2085 null as [mail_storeid],
2086 null as [mail_itemid],
2087 s.filepath as [file_path],
2088 s.filename as [file_name],
2089 'N' as [import_flag],
2090 null as [import_flag_utc_date],
2091 'N' as [import_status],
2092 null as [import_status_utc_date],
2093 'F' as [folder_flag],
2094 null as [folder_flag_utc_date],
2095 'N' as [folder_status],
2096 null as [folder_status_utc_date],
2097 'Y' as [folder_metadata_flag],
2098 null as [folder_metadata_flag_utc_date],
2099 'Y' as [folder_security_flag],
2100 null as [folder_security_flag_utc_date],
2101 'N' as [process_status],
2102 null as [process_status_utc_date],
2103 s.LIBRARY as [folder_database],
2104 null as [workspace_id],
2105 null as [folder_id],
2106 null as [folder_path],
2107 s.LIBRARY as [document_database],
2108 null as [document_number],
2109 null as [document_version],
2110 s.FILENAME as [docname],
2111 s.ENTRYWHEN as [entrywhen],
2112 s.EDITWHEN as [editwhen],
2113 null as [editprofilewhen],
2114 null as [declarewhen],
2115 null as [author],
2116 null as [operator],
2117 s.FILEPATH as [comments],
2118 s.APPLICATION as [type],
2119 'D' as [subtype],
2120 null as [class],
2121 null as [subclass],
2122 null as [archived],
2123 null as [markedforarchive],
2124 null as [frozen],
2125 null as [hasattachment],
2126 null as [retaindays],
2127 null as [lastuser],
2128 null as [extension],
2129 null as [messageid],
2130 s.client as [custom1],
2131 s.matter as [custom2],
2132 null as [custom3],
2133 null as [custom4],
2134 null as [custom5],
2135 null as [custom6],
2136 null as [custom7],
2137 null as [custom8],
2138 null as [custom9],
2139 null as [custom10],
2140 null as [custom11],
2141 null as [custom12],
2142 null as [custom13],
2143 null as [custom14],
2144 null as [custom15],
2145 null as [custom16],
2146 null as [custom17],
2147 null as [custom18],
2148 null as [custom19],
2149 null as [custom20],
2150 null as [custom21],
2151 null as [custom22],
2152 null as [custom23],
2153 null as [custom24],
2154 null as [custom25],
2155 null as [custom26],
2156 null as [custom27],
2157 null as [custom28],
2158 null as [custom29],
2159 null as [custom30],
2160 null as [custom31],
2161 'P' as [default_security]
2162FROM import_files_hold_1 s
2163LEFT OUTER JOIN dbo.tktb_import_doc_profile p
2164ON
2165 p.file_path = s.filepath
2166where
2167 p.import_id is null
2168
2169-- Set to reconcile where newer document exists.
2170PRINT('# of reconciles:');
2171Update t
2172SET
2173 import_flag =
2174 CASE
2175 WHEN t.import_status = 'C' THEN 'R'
2176 ELSE t.import_flag
2177 END,
2178 import_status = 'N',
2179 folder_flag = 'P',
2180 folder_status = 'N',
2181 folder_metadata_flag = 'N',
2182 folder_security_flag = 'Y',
2183 process_status = 'N',
2184 editwhen = s.editwhen
2185from import_files_hold_1 s
2186inner join dbo.tktb_import_doc_profile t
2187ON
2188 t.file_path = s.FILEPATH
2189where
2190 t.editwhen < s.EDITWHEN
2191GO
2192/****** Object: Table [dbo].[import_files_main] Script Date: 06/18/2013 16:33:33 ******/
2193SET ANSI_NULLS ON
2194GO
2195
2196SET QUOTED_IDENTIFIER ON
2197GO
2198
2199SET ANSI_PADDING ON
2200GO
2201
2202CREATE TABLE [dbo].[import_files_main](
2203 [UID] [int] IDENTITY(1,1) NOT NULL,
2204 [FILEPATH] [nvarchar](450) NULL,
2205 [FILENAME] [nvarchar](450) NULL,
2206 [OPERATOR] [varchar](32) NULL,
2207 [APPLICATION] [varchar](32) NULL,
2208 [EDITWHEN] [datetime] NULL,
2209 [ENTRYWHEN] [datetime] NULL,
2210 [MIGRATION] [varchar](20) NULL,
2211 [SCANTYPE] [varchar](20) NULL,
2212 [STATUS] [varchar](20) NULL,
2213 [LIBRARY] [varchar](100) NULL,
2214 [EXCEL_LINKED] [char](1) NULL,
2215 [SOURCE_SERVER] [varchar](20) NULL,
2216 [CUSTOM_PROPERTY1] [varchar](255) NULL,
2217 [CUSTOM_PROPERTY2] [varchar](255) NULL,
2218 [CUSTOM_PROPERTY3] [varchar](255) NULL,
2219 [BASELEVELFOLDER] [varchar](100) NULL,
2220 [WORKSPACENAME] [varchar](100) NULL,
2221 [INITIALFOLDER] [varchar](150) NULL,
2222 [CLIENT] [varchar](32) NULL,
2223 [MATTER] [varchar](32) NULL,
2224 [MSG_FROM] [varchar](96) NULL,
2225 [MSG_TO] [varchar](96) NULL,
2226 [MSG_CC] [varchar](96) NULL,
2227 [MSG_SENT] [datetime] NULL,
2228 [MSG_RECEIVED] [datetime] NULL,
2229 [HAS_ATTACHMENT] [char](1) NULL,
2230 [MSG_ID] [varchar](512) NULL
2231) ON [PRIMARY]
2232
2233GO
2234
2235SET ANSI_PADDING OFF
2236GO