Number of partitions?

I'm currently working on a database containing large, (100 million +) amounts of order information. This is due to be re-partitioned as part of an upgrade process. It seems most appropriate to perform range partitioning, but I was hoping someone could provide me with some information relating to performance impact based on the number of partitions.
The best I can explain it is, assume a graph with speed of query execution on the y axis and number of partitions on the x. At present I've no idea what shape this graph will be - is there a performance degradation as the number of partitions becomes too high, resulting in a bell curve?
I would assume the most sensible number of partitions would be acheived by dividing the data in the way that it is most commonly queried, (i.e. if most reports are run on monthly data, create monthly partitions) but again, this is all just speculation.
Any information or guidance greatly appreciated.

And if we have lots of radically different queries
then you cannot hope to satisfy them all: some will
be hit. So who do we privilege: the short running,
often used or the slow running, infrequently used?
No brainer, right? Except that we might need to ask
ourselves: who runs those queries? For instance,
which queries are run by the people who sign off the
IT Dept's budget? Might that influence our
decisions ;)I completely agree with you on this point. Initial design of one of our databases was done keeping the top management in mind... faster reports... on the click reports... I still wonder why it was so, when our internal SLA clearly stated that the administrative/management reports would run in approximately 2 minutes.
We then figured out a better method to achieve the same with some overnight jobs and at least got the MIS department happy about the performance of queries (which was delaying the other reports due to obvious reasons).
There is no simple solution. I accept this not from partitioning point of view but from entire database design point of view.
Thanks Andrew.

Similar Messages

  • Limit on the number of partitions a table can have

    Hi,
    It's been quite some time I'm thinking of a simple and the best solution to a performance issue in my application. Benefiting out of partitioning the table seems a simplest approach; it involves very minimal changes to my application code and in addition, it keeps the overall application logic 100% intact. However, at times, the number of partitions required can grow to as large as 500 thousand. I know of another application implementing as many as 50 thousand partitions for one of its tables. I'm wondering if Oracle recommends or poses any limit to a number of partitions the table can have. How does that limit, if it exists, vary if each of my table partition holds only a small amount of data; say, not more than 2 thousand records each of 1 KB size. What are the important considerations that one needs to keep in mind while creating the huge number of partitions for a table?
    Any inputs on this would be a great help.
    Thanks,
    Aniruddh
    ps: Consider Oracle releases 10g onwards.
    Edited by: Aniruddh on Dec 30, 2009 9:46 AM
    Edited by: Aniruddh on Dec 30, 2009 9:50 AM

    Aniruddh,
    >
    What are the important considerations that one needs to keep in mind while creating the huge number of partitions for a table?
    >
    I doubt if you are using partitioning for the right causes. Please explain how is your data structured and why you need to create so many partitions..?
    when creating partition, you need to consider..
    a) why you need to partition?
    b) how is your data structured
    c) how your data is indexed.
    d) What kind of queries would you firing on this table to get the data. Will they use the partition key ?
    Thanks,
    Rajesh.
    Please mark this/any other answer as helpful or answered if it is so. If not, provide additional details/feedback.
    Always try to provide create table and insert statements to help the forum members help you better.

  • Partition Manager is creating more than double number of partitions .

    Dear Team,
    I am facing a very weird scenario .
    For one of my product , one of the section is the Partition Manager executing for the Tables . Now I am facing a problem and it is really getting difficult for me to get to the root cause and thus posting in the forum ...
    I am having two Linux systems , in one of the system, installation of the product goes fine , and partition manager is doing the partition as intended .
    In another Linux lab , ( with some extra application installed ) , the same product is failing to install , and the problem is Partition Manager is doing the partition more than double as compared to first Lab and because of this it ends up using all the space in the system .
    My Concern is do we have any global setting for this Partition Manager in the Oracle Database , and because of this I am seeing the difference in this 2 labs ..I will be really thankful for any of the inputs and suggestion ...
    With Very Best Regards,
    Shail...
    Edited by: 999908 on 13 Apr, 2013 9:27 PM

    Hello Justin,
    First of all thanks a lot for your patience ... :) , in looking into my problem ..
    But I guess it is using Oracle partitioning Concept only...I dont think , my product is using the third party partition tool ( I will recheck this once to confirm )
    What I understand is that , if for any table the number of partitions is almost thrice in one system as compared to other , then it will end up consuming more space for the table in the system where it is creating more number of partitions ...
    I guess memory usage for any table also depends on the number of partitions ( Please do correct me if I am wrong here ) , if more number of partitions are there then more memory will be consumed , I guess..With Very Best Regards,
    Shail

  • IDEAL NUMBER OF PARTITIONS ON A TABLE

    Dear All,
    I have a table with crores or records.Can anyone suggest the number of partitions that are ideal to make on a table keeping in view aboutperformance of queries?
    Thanks,
    Deepu.

    In general partitioning is going to improve your select performance where you typically have many queries using predicates based on the same column, and the predicates return a significant number of rows such that accessing the table via an index-based method is inefficient.
    For example if you have a table of sales history and users commonly access the data with a predicate such as ...
    date_of_sale between sysdate -100 and sysdate - 50
    So, do you have many queries that select a relatively high number of rows based on predicates on a common column?
    Edit: By the way, 3Gb is not much data unless your hardware is really slow.
    Message was edited by:
    David Aldridge

  • Large (highest ?) Number of Partitions / SubPartitions in *Production*

    In theory, the maximum number of Partitions/SubPartitions that Oracle supports for a table is 1024K-1 in 10gR2.
    Per MetaLink Note#76765.1, the limit was 64K-1 in 8i -- and, I understand from the 9i docs, was also the same limit in 9i. The Note candidly admits that only 1,000 Partitions have been tested.
    Have you implemented / seen implemented, say 64thousand Partitions for a table (and this being done for possibly half-a-dozen tables), with at leaste one corresponding LOCALly Partitioned Index ?
    What are the implications on :
    1. MetaData in the Shared Pool and Latching.
    2. Gather_Stats (done GLOBAL or PARTITION wise).
    3. Queries that, very unfortunately, end up scanning all the partitions, many of which are small 64K partitions only.

    .

  • Maximum number of partitions allowed per table.

    Interesting findings with interval partitioning:
    SQL> SELECT  *
      2    FROM  v$version
      3  /
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> DROP TABLE tbl PURGE
      2  /
    Table dropped.
    SQL> CREATE TABLE tbl(
      2                   id number(6),
      3                   dt date
      4                  )
      5    PARTITION BY RANGE(dt)
      6      INTERVAL (INTERVAL '1' DAY)
      7      (
      8       PARTITION p1 VALUES LESS THAN (date '-857-12-31')
      9      )
    10  /
    Table created.
    SQL> select  partition_name,
      2          high_value
      3    from  user_tab_partitions
      4    where table_name = 'TBL'
      5  /
    PARTITION_NAME HIGH_VALUE
    P1             TO_DATE('-0857-12-31 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'N
                   LS_CALENDAR=GREGORIAN')
    SQL> INSERT
      2    INTO tbl
      3    VALUES(
      4           1,
      5           sysdate
      6          )
      7  /
    1 row created.
    SQL> DROP TABLE tbl PURGE
      2  /
    Table dropped.
    SQL> CREATE TABLE tbl(
      2                   id number(6),
      3                   dt date
      4                  )
      5    PARTITION BY RANGE(dt)
      6      INTERVAL (INTERVAL '1' DAY)
      7      (
      8       PARTITION p1 VALUES LESS THAN (date '-858-01-01')
      9      )
    10  /
    Table created.
    SQL> select  partition_name,
      2          high_value
      3    from  user_tab_partitions
      4    where table_name = 'TBL'
      5  /
    PARTITION_NAME HIGH_VALUE
    P1             TO_DATE('-0858-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'N
                   LS_CALENDAR=GREGORIAN')
    SQL> INSERT
      2    INTO tbl
      3    VALUES(
      4           1,
      5           sysdate
      6          )
      7  /
      INTO tbl
    ERROR at line 2:
    ORA-14300: partitioning key maps to a partition outside maximum permitted number of partitions
    SQL> From Logical Database Limits:
    Maximum number of partitions allowed per table or index: 1024K - 1
    I always thought limit implies to number of actual, not potential partitions, however it looks like I was wrong, although it makes not much sense to limit potential and not actual partitions:
    SQL> select  trunc(sysdate) - date '-858-01-01',
      2          1024 * 1024 - 1
      3    from  dual
      4  /
    TRUNC(SYSDATE)-DATE'-858-01-01' 1024*1024-1
                            1048661     1048575
    SQL> select  to_char(DATE'-858-01-01' + 1048575,'MM/DD/YYYY')
      2    from  dual
      3  /
    TO_CHAR(DA
    11/17/2012
    SQL> So tomorrow "magic" date should increase by one day. I'll test it. But more interesting if tomorrow I will be able to insert a row that forms a new partition into table TBL.
    SY.

    rp0428 wrote:
    The other argument is that Oracle has to be able to automatically create any partition required and it can only create 1024k - 1. So if you create yours with sysdate how could it create all of the others?Not sure I follow. What is the purpose of counting potential partitions? Partition part# iin sys.tabpart$ is not assigned based on potential partition position. If I issue a DDL to create new partition regardless of interval/non-interval partitioning Oracle has to check how many partitions table has so far or po and raise same/similar exception if partition I am asking to create is over the limit. And, in any case, knowing we can create all potential partitions at table create time doesn't mean I will not try to insert data outside the range. So there is absolutely no guarantee Oracle can automatically create any partition requested. Again, I don't understand why creating non-interval partitioned table with a single initial partition has partition count of 1:
    SQL> DROP TABLE tbl1 PURGE
      2  /
    Table dropped.
    SQL> CREATE TABLE tbl1(
      2                    id number(6),
      3                    dt date
      4                   )
      5    PARTITION BY RANGE(dt)
      6      (
      7       PARTITION p1 VALUES LESS THAN (date '-857-12-31')
      8      )
      9  /
    Table created.
    SQL> SELECT  partition_count
      2    FROM  user_part_tables
      3    WHERE table_name = 'TBL1'
      4  /
    PARTITION_COUNT
                  1
    SQL>And interval partitioned table with same single initial partition has partition count of 1048575:
    SQL> CREATE TABLE tbl1(
      2                    id number(6),
      3                    dt date
      4                   )
      5    PARTITION BY RANGE(dt)
      6      INTERVAL (INTERVAL '1' DAY)
      7      (
      8       PARTITION p1 VALUES LESS THAN (date '-857-12-31')
      9      )
    10  /
    Table created.
    SQL> SELECT  partition_count
      2    FROM  user_part_tables
      3    WHERE table_name = 'TBL1'
      4  /
    PARTITION_COUNT
            1048575
    SQL> Would be interesting to find out what forces Oracle to go into potential partition mode for interval partitioning.
    SY.

  • Query latency vs number of partitions

    I am trying to measure the average latency per object retrieval using the query approach, and what I am finding is that as the number of instances of the server (a server being a single jvm running DefaultCacheServer with backup-count set to 1, and partition-count set to 1021) increases, the latency increases significantly as shown in the results below:
    Latency (microseconds) for Number of server instances
    Objects 2 4 8 16
    In Cache srvrs srvrs srvrs srvrs
    1K 593 730 889 1175
    10K 592 720 880 1206
    50K 580 724 879 1200
    100K 585 726 877 1204
    The query code is as follows:
    final Filter filter = new EqualsFilter(idExtractor, key);
    final Filter limitedFilter = new LimitFilter(filter, 1);
    final Set spotPricesKeys = cache.keySet(limitedFilter);
    if (spotPricesKeys != null && spotPricesKeys.size() > 0){
         spotPrice = (SpotPrice) cache.get(spotPricesKeys.iterator().next());
    and
    private static ValueExtractor idExtractor = new KeyExtractor("intValue");
    Any idea why the latency is increasing with the added number of server instances?
    Thanks
    Adsen

    Partitioning strategies is an "advanced" feature of Coherence. It works much like a hash function but instead of a hash code it calculates the partition number that will be used for each key. You can use more or less any deterministic algorithm based only on key information. Lets assume that you have a cache with strings as keys (representing for instance a persons name) and you would like to partition based on the first letter it could look something like this (this is just an example - in production code you would like to make sure the algorithm statistically makes as even use of all the partitions that you have in your cluster!):
    public class MyPartitionStrategy implements KeyPartitioningStrategy, Serializable {
    private PartitionedService partitionedService;
    public MyPartitionStrategy() {
    public void init(final PartitionedService partitionedService) {
    this.partitionedService = partitionedService;
    public int getKeyPartition(final Object key) {
    if (key instanceof String) {
    return ((String) key).charAt(0) % (partitionedService.getPartitionCount() + 1);
    } else {
    return key.hashCode() % (partitionedService.getPartitionCount() + 1);
    With this filter you would know that all keys starting with the same first letter ends up in the same partition. You would specify the use of this filter once in the coherence configuration (dont remember the element to use on top of my head though).
    Now assume that you for some reason want to do some query that only should apply to entries with a key starting with the letter 'a' you could do that with a PartitionedFilter (you would have to write some code that determines what partition the key 'a' would end up if it existed and then restrict the query to that single partiton). With this solution Coherence will only send the request to the single node holding the primary for that one partition holding all the "axxxx" keys and not to all the nodes in the cluster making the query scale close to linerary no matter how many nodes you have!
    A problem when the number of partitions grow is to find a partitioning strategy that allocates a useful set of objects into a single partition. If you for instance have like 4000+ partitions and would like to divide addresses based on state in order to perfrom queries against all of your customers in a particular state there is no obvious way to do that since the number of states is much smaller than the number of partitions :-(
    This kind of partitioning can however be very useful in many cases (we have used it to good effect in my current project).
    In produktion code it is often some part of a composite key that is useful as a key partitioning criteria and you could then for instance return the standard hash code of that key part modulus he partition count.
    Another possibly useful feature you may look at is when it comes to limiting the number of nodes invloved in queries is the KeyAssociatedFilter (if you use key association at all in your cache).
    /Magnus

  • How to read volume serial number of partition?

    Hi All,
    Is it possible to read Volume Serial Number of partition through java?
    Thanks in advance!!
    Chetan Parekh

    Hi,
    I have a same problem...................
    Where i need to find out the volume serial number through java.it is microsoft platform( win 2000 & win NT)
    Can any Java Expert send me the java code for this.................Pls help me out
    Thanx in advance
    Sachin

  • Number range partition

    Hi
    I have  a number range from 00001 to 99999 and i want to partition my nuber rangec into 3 parts.
    To use number range in report program i can call function 'NUMBER_GET_NEXT' but how can i partion my number range so that:
    00001-20000 is sales order
    20001-40000 is purchase order
    40001-50000 is receipt order.
    Please note i dont have to create a seprate number range for the same.
    Regards
    Preeti Khurana

    lv_count =  range_high - range_low.
          lv_count = lv_count + 1.
           do lv_count times.
              wa_gl-VONKT = wa_repcode-VONKT.
               append wa_gl to lt_gl.
            wa_repcode-VONKT = wa_repcode-VONKT + 1.
              CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
               EXPORTING
                 INPUT  = wa_repcode-VONKT
                IMPORTING
                  OUTPUT = wa_repcode-VONKT.
            enddo.
    it will give u the gl by splitting it from the range and append into an internal table.
    U can use 2 more internal table and add some condition and split the range.
    eg:
    *00001-20000 is sales order
    *20001-40000 is purchase order
    *40001-50000 is receipt order.
    lv_count =  wa_repcode-belnr_HIGH - wa_repcode-belnr_low.
          lv_count = lv_count + 1.
           do lv_count times.
               if wa_gl-belnr le 2000.
              wa_gl1-belnr = wa_repcode-belnr.
               append wa_gl1 to lt_gl1.
               else if wa_gl-belnr ge 2001
               wa_gl-belnr = wa_repcode-belnr.
                   if wa_gl2-belnr ge 4001
               append wa_gl3 to lt_gl3.
              else.
         append wa_gl2 to lt_gl3.
         endif.
            wa_repcode-belnr = wa_repcode-belnr + 1.
              CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
               EXPORTING
                 INPUT  = wa_repcode-belnr
                IMPORTING
                  OUTPUT = wa_repcode-belnr.
            enddo.
    Am using the function module to get the order number in 10 digit. U can use the fc according to ur requirement..

  • Row Number() over partition by Order by in OBIEE Physical SQL

    Hi ,
    I created a OBIEE report in Dev using Answers. When I move the same report to Live, the count of rows was more in Live environment when compared to Dev.
    The objects count is same in both Dev and Production.
    WheniI verified the log file, I found that the Physical SQL in test has
    ROW_NUMBER ()
    OVER
    PARTITION BY c1, c4, c5 order by c1,c4,c5) whereas the physical SQL in Production has
    ROW_NUMBER ()
    OVER
    PARTITION BY c1, c4, c5, c8,c9 order by c1,c4,c5,c8,c9)
    How this Partiton is done in OBIEE. I have just copied the report from catalog and moved to production.There is no changes in report.
    Whether there are any settings to control it? HOw OBIEE does this Row Number() Partiton ? How can get this similiar to Test?
    Please help!
    Thanks
    Johnny

    Hi Saichand,
    The links were helpful. But i am not getting how it is working in test and not in live.
    I found one difference while deploying . The column names of the object both in Test and Production had spaces.For E.g: Full Name
    When this column Full Name is pulled to the repsository in test , it automatically put double quotes for the column names in the physical sql when it hits the database.
    But, In production , when I pulled the column the report gave error as Invalid Identifier since OBIEE generated column name as Full Name without double quotes.
    Then I changed the column in Phyiscal Layer repository by having double Quotes for all columns. Afte that report worked fine.
    Whether this has caused any issue in Row Partition.
    Is there any setting to have column name in Double Quotes ?
    Thanks,
    Johnny

  • Is it possible to bypass the number of partitions limitation (no more than 2) when trying to boot into windows by not using boot camp assistant, and instead just partitioning the drive manually?

    I can't find a specific answer to this question.
    I did have a functioning Windows 8 installation on my MacBook Pro previously. I tried to make a third exFAT partition so as to have a drive mutually readable/writable to both operating systems. This made it so I could no longer boot into my Windows installation.
    I know I'll need the boot camp drivers installed on the Windows installation after the fact, but would manually creating a partition and installing the OS without Boot Camp Assistant work? And would I be able to boot from it while having a total of 3 partitions?

    That's the spirit! 
    Just be sure to have your OS X junk safe in a tested backup, in case the whole thing craps out and you end up having to do a low-level partition and erase of the entire drive.
    And like I said, the problem is not OS X. I've set up mine at least once with 4 partitions holding as many flavors of OS X as can run on the hardware, all perfectly bootable on demand.

  • Abap code to check number of partitions in the cubes.

    Hello All,
    I am working on Performance Tuning and need to delete(DROP_EMPTY_FPARTITIONS) the empty partitions and
    i need the code(Program) for finding Cubes/Aggregates with more than x empty Partitions.
    Thank you for your time and consideration.
    Nisha Jagtaap.

    Hi Nisha.
    I would like to suggest a reference,
    [SDN Wiki - Standard Reference for BW system tuning - Info Cubes removing Drop empty partitions|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/bw%2bsystem%2btuning]
    [SDN Library - Standard Reference - PDF - Performance Tuning Massive SAP BW Systems - Tips and Tricks - Drop empty partitions|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94]
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • HT201250 Can I partition my external hard drive and use one partion for time machine and the other one for data that i may want to use in different computers?

    I have this doubt. I've just bought an external drive, especifically a Seagate GoFlex Desk 3 tb.
    I want to know if it is recomendable to make a partion exclusively for time machine and let another one so I can put there music, photos, videos, etc that I should need to use or copy to another computer.
    May half and half, 1.5 tb for time machine and 1.5 tb for data.
    I have an internal hard drive of 500 GB (499.25 GB) in my macbook pro.
    Any recommendation?

    As I said, yes. Be sure your Time Machine partition has at least 1 TB for backups.
    1. Open Disk Utility in your Utilities folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to two (2). Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed.

  • External hard drive will not partition correctly

    This is a somewhat long post, but the point is this: I have a new 1TB Fantom GreenDrive (attached via USB) which I cannot partition the way that I want to. I want to allocate 300G for a Time Machine backup partition and the remainder as a partition for everything else. For some reason, I'm only able to partition the drive so that it has two equal-size partitions. While this isn't terrible (the 300G figure was somewhat arbitrary), I'm curious to see if anyone knows what's going on here. As part of my tale, I list three "mysteries" that have really stumped me.
    For at least a year now, I've had two external USB drives attached to my machine through a hub. One (a Fantom Titanium-II 500G drive) was for Time Machine, and the other (a LaCie 150G drive) was for other files. These drives were almost always connected to my machine, and they were almost always powered on. About three weeks ago, the Time Machine drive started unmounting, seemingly randomly, from the computer. When I tried to verify it in Disk Utility, it gave me an error, and the drive would again unmount. At the same time, I started having problems with the LaCie drive - when I plugged it in, the Mac gave me a message saying that the drive wasn't working properly and that I had to back up everything on it.
    This all seemed too coincidental to me, and so is the first mystery of my saga. However, I saw the GreenDrive on sale and decided to pick one up, rather than trying to fix the two drives. When I connected the GreenDrive to the computer, it was formatted at NTSF. When I tried to format it as Mac OS Extended (Journaled), Disk Utility gave me an error.
    If I booted the Mac into Windows, I could format the drive again as NTSF, and it would work fine. When I went back into the Mac side, it worked there, too (that is, I could read from it and write to it). Also, I could use Disk Utility to format the drive as MS-DOS (FAT). Of course, I needed to format the drive for the Mac so that it would work for Time Machine.
    When I went into the Time Machine preference pane and selected the GreenDrive for Backup (which was still formatted as MS-DOS (FAT) at the time), and did the erasing from within Time Machine, I was able to get the drive formatted as one large Mac OS formatted partition. Why I was able to successfully format it from Time Machine, but not from Disk Utility (which I believe is what Time Machine uses for the erasing, anyway) is the second mystery.
    So, now I had a 1TB hard drive set up a single partition. I still wanted to divide it in two. However, when I tried using Disk Utility to partition it the way I wanted, I got an error saying the partition failed. Just as a test, I tried partitioning as two equal-size partitions, and this worked. Why it would let me partition in this configuration, and not the way I wanted, is the third and final mystery.
    In the end, I'm almost where I want to be. I had to spend a little bit of money, but I have more total storage space available, and it seems to be working fine. Also, I was able to format the LaCie drive, and it seems to be working well, so it wasn't a total loss. Still, any answers you guys can provide would be greatly appreciated.
    <Edited by Moderator>

    Be sure your drive is initially partitioned into one single volume. Then format the volume for Mac OS Extended. Once that's done re-partition the drive into two volumes (if that's what you desire) then resize them as you want. How you do the resizing may be important. Usually the larger volume is the first or top volume. Select it by clicking on its rectangle in the sizing gadget. Then in the Size field enter the size you want. That should result in the first volume being resized to what you want and the second volume automatically resizes accordingly.
    Here's how I suggest doing it:
    Extended Hard Drive Preparation
    1. Open Disk Utility in your Utilities folder. If you need to reformat your startup volume, then you must boot from your OS X Installer Disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Installer menu (Utilities menu for Tiger or Leopard.)
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area. If it does not say "Verified" then the drive is failing or has failed and will need replacing. SMART info will not be reported on external drives. Otherwise, click on the Partition tab in the DU main window.
    3. Set the number of partitions from the drop down menu (use 1 partition unless you wish to make more.) Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID (only required for Intel Macs) then click on the OK button. Click on the Partition button and wait until the process has completed.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process can take up to several hours depending upon the drive size.

  • Error: Partition function can only be created in Enterprise edition of SQL Server

    By using the Generate Scripts option in SSMS, I've duplicated this DB seven times so far. I do this due to the 10 Gig limit on Sql Express 2012.  I was doing this again today. I generated the script, did a search/replace to provide a new DB name for
    DB number eight in the series, and then I ran the script to create the DB, causing the error message. I don't remember seeing this error in the past. It's possible I created the first edition of this DB at home, but back then I only had express edition as
    I seem to recall (although I did purchase Developer a few months ago).
    I don't even know what the Partition function does. I'll try to look that up tonight.
    SSMS did create the DB, I just hope the error message doesn't forebode any problems.
    USE [master]
    GO
    /****** Object: Database [Year2014_Aug_To_Dec] Script Date: 07/29/2014 03:55:19 PM ******/
    CREATE DATABASE [Year2014_Aug_To_Dec]
    CONTAINMENT = NONE
    ON PRIMARY
    ( NAME = N'Year2014_Aug_To_Dec', FILENAME = N'F:\FlatFilesDatabases\Year2014_Aug_To_Dec.mdf' , SIZE = 8832000KB , MAXSIZE = UNLIMITED, FILEGROWTH = 204800KB )
    LOG ON
    ( NAME = N'Year2014_Aug_To_Dec_Log', FILENAME = N'F:\FlatFilesDatabases\Year2014_Aug_To_Dec_Log.ldf' , SIZE = 230400KB , MAXSIZE = 2048GB , FILEGROWTH = 204800KB )
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET COMPATIBILITY_LEVEL = 110
    GO
    IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
    begin
    EXEC [Year2014_Aug_To_Dec].[dbo].[sp_fulltext_database] @action = 'enable'
    end
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET ANSI_NULL_DEFAULT OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET ANSI_NULLS OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET ANSI_PADDING OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET ANSI_WARNINGS OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET ARITHABORT OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET AUTO_CLOSE ON
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET AUTO_CREATE_STATISTICS ON
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET AUTO_SHRINK OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET AUTO_UPDATE_STATISTICS ON
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET CURSOR_CLOSE_ON_COMMIT OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET CURSOR_DEFAULT GLOBAL
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET CONCAT_NULL_YIELDS_NULL OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET NUMERIC_ROUNDABORT OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET QUOTED_IDENTIFIER OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET RECURSIVE_TRIGGERS OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET DISABLE_BROKER
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET DATE_CORRELATION_OPTIMIZATION OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET TRUSTWORTHY OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET ALLOW_SNAPSHOT_ISOLATION OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET PARAMETERIZATION SIMPLE
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET READ_COMMITTED_SNAPSHOT OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET HONOR_BROKER_PRIORITY OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET RECOVERY SIMPLE
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET MULTI_USER
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET PAGE_VERIFY CHECKSUM
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET DB_CHAINING OFF
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET TARGET_RECOVERY_TIME = 0 SECONDS
    GO
    USE [Year2014_Aug_To_Dec]
    GO
    /****** Object: User [NT SERVICE\MSSQL$SQLEXPRESS] Script Date: 07/29/2014 03:55:20 PM ******/
    CREATE USER [NT SERVICE\MSSQL$SQLEXPRESS] FOR LOGIN [NT Service\MSSQL$SQLEXPRESS] WITH DEFAULT_SCHEMA=[NT SERVICE\MSSQL$SQLEXPRESS]
    GO
    /****** Object: User [NT Authority\Authenticated Users] Script Date: 07/29/2014 03:55:20 PM ******/
    CREATE USER [NT Authority\Authenticated Users] FOR LOGIN [NT AUTHORITY\Authenticated Users] WITH DEFAULT_SCHEMA=[NT Authority\Authenticated Users]
    GO
    /****** Object: User [BUILTIN\USERS] Script Date: 07/29/2014 03:55:20 PM ******/
    CREATE USER [BUILTIN\USERS] FOR LOGIN [BUILTIN\Users]
    GO
    /****** Object: Schema [NT Authority\Authenticated Users] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE SCHEMA [NT Authority\Authenticated Users]
    GO
    /****** Object: Schema [NT SERVICE\MSSQL$SQLEXPRESS] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE SCHEMA [NT SERVICE\MSSQL$SQLEXPRESS]
    GO
    /****** Object: FullTextCatalog [Catalog1] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE FULLTEXT CATALOG [Catalog1]WITH ACCENT_SENSITIVITY = ON
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_06A2E7C5] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_06A2E7C5](varbinary(128)) AS RANGE LEFT FOR VALUES (0x00390039003200380035, 0x006E006E0033003000320034)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_11A1FB2A] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_11A1FB2A](varbinary(128)) AS RANGE LEFT FOR VALUES (0x006100730073006F006300690061007400650073, 0x006E006E003200320032003700350037003300310030003400300035)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_171D3F63] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_171D3F63](varbinary(128)) AS RANGE LEFT FOR VALUES (0x00610072006900650078006900650074, 0x006E006E003200390035003200330033003400310030)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_1FA6CD15] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_1FA6CD15](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0063006F00720070006F0072006100740069006F006E, 0x006E006E0033003500340031003800390031)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_25DC6753] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_25DC6753](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0061007000700072006F007600650064, 0x006E006E00320033003200380035)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_2B429CF3] Script Date: 07/29/2014 03:55:21 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_2B429CF3](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0069006E006500730068006F006D)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_2D3F28A7] Script Date: 07/29/2014 03:55:22 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_2D3F28A7](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0062006F0078, 0x006E006E003200390034003900320033003000350033)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_32ED1505] Script Date: 07/29/2014 03:55:22 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_32ED1505](varbinary(128)) AS RANGE LEFT FOR VALUES (0x006100690064, 0x006E006E00330036)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_3E6129B6] Script Date: 07/29/2014 03:55:22 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_3E6129B6](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0036003600340038, 0x006C00610074006F0074, 0x006E006E00360031003800380038)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_3FC721DF] Script Date: 07/29/2014 03:55:22 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_3FC721DF](varbinary(128)) AS RANGE LEFT FOR VALUES (0x006300680075006E006B, 0x006E006E0034003300330031006400360031)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_4695B1AD] Script Date: 07/29/2014 03:55:22 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_4695B1AD](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0061006D006F0075006E0074, 0x006E006E003200370064003200330032)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_475E2206] Script Date: 07/29/2014 03:55:23 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_475E2206](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0061007200610079006B)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_52082FB0] Script Date: 07/29/2014 03:55:23 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_52082FB0](varbinary(128)) AS RANGE LEFT FOR VALUES (0x00640065007400610069006C, 0x006E006E003300300038003400320032)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_53473803] Script Date: 07/29/2014 03:55:23 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_53473803](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0061006F00730069, 0x006E006E003200350032003900340031)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_6A54BA8D] Script Date: 07/29/2014 03:55:23 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_6A54BA8D](varbinary(128)) AS RANGE LEFT FOR VALUES (0x00620061006E006B, 0x006E006E003300310064003000370032)
    GO
    /****** Object: PartitionFunction [ifts_comp_fragment_partition_function_7D7C9D9A] Script Date: 07/29/2014 03:55:23 PM ******/
    CREATE PARTITION FUNCTION [ifts_comp_fragment_partition_function_7D7C9D9A](varbinary(128)) AS RANGE LEFT FOR VALUES (0x0063006100720072006900650072, 0x006E006E00330032003700330033)
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_06A2E7C5] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_06A2E7C5] AS PARTITION [ifts_comp_fragment_partition_function_06A2E7C5] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_11A1FB2A] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_11A1FB2A] AS PARTITION [ifts_comp_fragment_partition_function_11A1FB2A] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_171D3F63] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_171D3F63] AS PARTITION [ifts_comp_fragment_partition_function_171D3F63] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_1FA6CD15] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_1FA6CD15] AS PARTITION [ifts_comp_fragment_partition_function_1FA6CD15] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_25DC6753] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_25DC6753] AS PARTITION [ifts_comp_fragment_partition_function_25DC6753] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_2B429CF3] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_2B429CF3] AS PARTITION [ifts_comp_fragment_partition_function_2B429CF3] TO ([PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_2D3F28A7] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_2D3F28A7] AS PARTITION [ifts_comp_fragment_partition_function_2D3F28A7] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_32ED1505] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_32ED1505] AS PARTITION [ifts_comp_fragment_partition_function_32ED1505] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_3E6129B6] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_3E6129B6] AS PARTITION [ifts_comp_fragment_partition_function_3E6129B6] TO ([PRIMARY], [PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_3FC721DF] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_3FC721DF] AS PARTITION [ifts_comp_fragment_partition_function_3FC721DF] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_4695B1AD] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_4695B1AD] AS PARTITION [ifts_comp_fragment_partition_function_4695B1AD] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_475E2206] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_475E2206] AS PARTITION [ifts_comp_fragment_partition_function_475E2206] TO ([PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_52082FB0] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_52082FB0] AS PARTITION [ifts_comp_fragment_partition_function_52082FB0] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_53473803] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_53473803] AS PARTITION [ifts_comp_fragment_partition_function_53473803] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_6A54BA8D] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_6A54BA8D] AS PARTITION [ifts_comp_fragment_partition_function_6A54BA8D] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: PartitionScheme [ifts_comp_fragment_data_space_7D7C9D9A] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE PARTITION SCHEME [ifts_comp_fragment_data_space_7D7C9D9A] AS PARTITION [ifts_comp_fragment_partition_function_7D7C9D9A] TO ([PRIMARY], [PRIMARY], [PRIMARY])
    GO
    /****** Object: StoredProcedure [dbo].[Files_RecordCountLastThreeDays_ByFolder] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROC [dbo].[Files_RecordCountLastThreeDays_ByFolder]
    @ListOfFolders varchar(max)
    AS
    -- This query pulls only those folders DID have at least one success (a new file added)
    With FoldersWithHits AS(
    SELECT COUNT(*) AS NUMFILESADDED, Value as Folder
    FROM funcSplit('|', @ListOfFolders) As Folders
    inner join Files on CHARINDEX(Folders.Value, Files.AGGREGATEPATH) = 1
    WHERE DateAdded > DATEADD(DD, -4, GETDATE())
    Group By Value
    Select * from FoldersWithHits
    Union All
    -- To get a list of those folders that did NOT have any new files added,
    -- resuse the first query - use the above list of successes to do an exclusion
    select 0 as NumFilesAdded, Folders.VAlue as Folder
    From funcSplit('|', @ListOfFolders) As Folders
    Left Join FoldersWithHits on FoldersWithHits.Folder = Folders.Value
    Where FoldersWithHits.folder is null
    GO
    /****** Object: StoredProcedure [dbo].[FILES_SP_FINDTHISMOVEDFILE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE Proc [dbo].[FILES_SP_FINDTHISMOVEDFILE]
    @NameOfFile varchar(2000),
    @NameOfZipFile varchar(2000),
    @FileSize int
    As
    -- Here find the zipfile by passing in the name of the zipfile as @NameOfZipFile
    Select AggregatePath, 'Found ZipFile By Name' as TypeOfHit From dbo.Files where NameOfFile = @NameOfZipFile
    UNION
    Select AggregatePath, 'Found ZipFile By Name' as TypeOfHit From dbo.FilesNewLocations where NameOfFile = @NameOfZipFile
    UNION
    -- Here find the file itself (not just the zipfile) by finding two names: the filename and zipFilename.
    Select AggregatePath, 'Found Filename' as TypeOfHit From dbo.FilesNewLocations where Len(NameOfZipFile) > 0 AND NameOfFile = @NameOfFile And NameOfZipFile = @NameOfZipFile
    union
    Select AggregatePath, 'Found Filename' as TypeOfHit From dbo.FilesNewLocations where Len(NameOfZipFile) > 0 AND NameOfFile = @NameOfFile And NameOfZipFile = @NameOfZipFile
    union
    -- Here find the file by size
    Select AGGREGATEPATH, 'Found By Size' as TypeOfHit From dbo.Files where FileSize = @FileSize ANd NameOfFile = @NameOfFile
    UNION
    Select AGGREGATEPATH, 'Found By Size' as TypeOfHit From dbo.FilesNewLocations where FileSize = @FileSize ANd NameOfFile = @NameOfFile
    Grant Execute ON dbo.Files_SP_FindThisMovedFile To [BuiltIn\Users]
    CREATE NONCLUSTERED INDEX idx_FilesNewLocations_CreationDate ON Files (CreationDate)
    CREATE NONCLUSTERED INDEX idx_FilesNewLocations_FileSize ON Files (FileSize)
    CREATE NONCLUSTERED INDEX idx_FilesNewLocations_NameOfFile ON Files (NameOfFile)
    CREATE NONCLUSTERED INDEX idx_FilesNewLocations_NameOfZipFile ON Files (NameOfZipFile)
    CREATE NONCLUSTERED INDEX idx_FilesNewLocations_AggregatePath ON Files (AggregatePath)
    GO
    /****** Object: StoredProcedure [dbo].[FILES_SP_GETEPOCALIPSETEXT] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[FILES_SP_GETEPOCALIPSETEXT]
    @AGGREGATEPATH VARCHAR(700)
    AS
    SET NOCOUNT ON
    SELECT F.EPOCALIPSETEXT FROM FILES AS F
    WHERE F.AGGREGATEPATH = @AGGREGATEPATH
    GO
    /****** Object: StoredProcedure [dbo].[FILES_SP_INSERTFILE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[FILES_SP_INSERTFILE]
    @AGGREGATEPATH VARCHAR(4000),
    @CREATIONDATE DATETIME,
    @EPOCALIPSETEXT VARCHAR(MAX),
    @FILEID INT OUTPUT,
    @PC VARCHAR(2000),
    @FILESIZE INT,
    @NAMEOFFILE VARCHAR(2000),
    @ZIPPED BIT,
    @NAMEOFZIPFILE VARCHAR(2000)
    AS
    SET NOCOUNT ON
    DECLARE @DATEADDED SMALLDATETIME
    SELECT @DATEADDED = CONVERT(VARCHAR(12), GETDATE(), 101)
    INSERT INTO DBO.FILES (DATEADDED, AGGREGATEPATH, CREATIONDATE,EPOCALIPSETEXT, PC, FILESIZE, NAMEOFFILE, ZIPPED, NAMEOFZIPFILE)
    VALUES(@DATEADDED, @AGGREGATEPATH,@CREATIONDATE,@EPOCALIPSETEXT, @PC, @FILESIZE, @NAMEOFFILE, @ZIPPED, @NAMEOFZIPFILE)
    SELECT @FILEID=SCOPE_IDENTITY()
    GO
    /****** Object: StoredProcedure [dbo].[FILES_SP_ISDUPFILE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[FILES_SP_ISDUPFILE]
    @AGGREGATEPATH VARCHAR(2000)
    AS
    SET NOCOUNT ON
    SELECT FILEID FROM DBO.FILES WHERE AGGREGATEPATH= @AGGREGATEPATH
    GO
    /****** Object: StoredProcedure [dbo].[FILES_SP_RECORDCOUNTLASTSEVENDAYS] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROC [dbo].[FILES_SP_RECORDCOUNTLASTSEVENDAYS]
    AS
    SELECT PC, COUNT(*) AS NUMFILESADDED, CONVERT(VARCHAR(12),CONVERT(SMALLDATETIME, DATEADDED, 101), 101) AS DATEADDED FROM FILES
    WHERE DATEADDED > DATEADD(DD, -9, GETDATE())
    GROUP BY PC, CONVERT(SMALLDATETIME, DATEADDED, 101)
    ORDER BY PC, CONVERT(SMALLDATETIME, DATEADDED, 101) DESC
    GO
    /****** Object: StoredProcedure [dbo].[FILESNEWLOCATIONS_SP_INSERTFILE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[FILESNEWLOCATIONS_SP_INSERTFILE]
    @AGGREGATEPATH VARCHAR(4000),
    @CREATIONDATE DATETIME,
    @FILESIZE INT,
    @NAMEOFFILE VARCHAR(2000),
    @NAMEOFZIPFILE VARCHAR(2000)
    AS
    SET NOCOUNT ON
    INSERT INTO DBO.FILESNEWLOCATIONS (AGGREGATEPATH, CREATIONDATE,FILESIZE, NAMEOFFILE, NAMEOFZIPFILE)
    VALUES(@AGGREGATEPATH,@CREATIONDATE,@FILESIZE, @NAMEOFFILE, @NAMEOFZIPFILE)
    GRANT EXECUTE ON DBO.FILESNEWLOCATIONS_SP_INSERTFILE TO [BUILTIN\USERS]
    GO
    /****** Object: StoredProcedure [dbo].[FILESNEWLOCATIONS_SP_ISDUPNEWLOCATION] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[FILESNEWLOCATIONS_SP_ISDUPNEWLOCATION]
    @AGGREGATEPATH VARCHAR(2000)
    AS
    SET NOCOUNT ON
    SELECT COUNT(*) FROM DBO.FILESNEWLOCATIONS WHERE AGGREGATEPATH= @AGGREGATEPATH
    GO
    /****** Object: StoredProcedure [dbo].[FOLDERS_SP_DELETEALLFOLDERS] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[FOLDERS_SP_DELETEALLFOLDERS]
    AS
    SET NOCOUNT ON
    DELETE FROM FOLDERS
    GO
    /****** Object: StoredProcedure [dbo].[FOLDERS_SP_INSERTFOLDER] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROC [dbo].[FOLDERS_SP_INSERTFOLDER]
    @THEPATH VARCHAR(4000),
    @FRIENDLYNAME VARCHAR(4000)
    AS
    INSERT INTO FOLDERS ([PATH], FRIENDLYNAME) VALUES (@THEPATH, @FRIENDLYNAME)
    GO
    /****** Object: StoredProcedure [dbo].[MISC_SP_SETDBSTARTDATEANDENDDATE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[MISC_SP_SETDBSTARTDATEANDENDDATE]
    @STARTDATE DATETIME,
    @ENDDATE DATETIME
    AS
    BEGIN
    DECLARE @HASDATE TINYINT
    SELECT @HASDATE = COUNT(*) FROM MISC WHERE KIND LIKE 'STARTDATE'
    IF @HASDATE > 0
    BEGIN
    UPDATE DBO.MISC
    SET DATECOL =
    CASE KIND
    WHEN 'STARTDATE' THEN @STARTDATE
    WHEN 'ENDDATE' THEN @ENDDATE
    END
    END
    ELSE
    BEGIN
    INSERT INTO DBO.MISC(KIND, DATECOL) VALUES('STARTDATE', @STARTDATE)
    INSERT INTO DBO.MISC(KIND, DATECOL) VALUES('ENDDATE', @ENDDATE)
    END
    END
    GO
    /****** Object: StoredProcedure [dbo].[PAGES_SP_FINDWORDFORSELECTEDFOLDERS] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[PAGES_SP_FINDWORDFORSELECTEDFOLDERS]
    @KEYWORD VARCHAR(500),
    @STARTDATE DATETIME,
    @ENDDATE DATETIME
    AS
    SET NOCOUNT ON
    SELECT TOP 5000 * FROM
    SELECT P.PAGENO AS PGNO,FD.FRIENDLYNAME AS FOLDER, F.CREATIONDATE, 'PAGE' AS [TYPE], F.AGGREGATEPATH AS FULLPATH FROM
    CONTAINSTABLE(PAGES, OCRTEXT, @KEYWORD) AS FULLTEXTTABLE
    INNER JOIN PAGES AS P ON P.PAGEID = FULLTEXTTABLE.[KEY]
    INNER JOIN FILES AS F ON F.FILEID = P.FILEID
    INNER JOIN FOLDERS AS FD ON CHARINDEX(FD.PATH + '\', F.AGGREGATEPATH) = 1
    WHERE F.CREATIONDATE BETWEEN @STARTDATE AND @ENDDATE
    UNION ALL
    SELECT NULL AS PGNO, FD.FRIENDLYNAME AS FOLDER, F.CREATIONDATE, 'FILE' AS [TYPE], F.AGGREGATEPATH AS FULLPATH FROM
    CONTAINSTABLE(FILES, EPOCALIPSETEXT, @KEYWORD) AS FULLTEXTTABLE
    INNER JOIN FILES AS F ON F.FILEID = FULLTEXTTABLE.[KEY]
    INNER JOIN FOLDERS AS FD ON CHARINDEX(FD.PATH + '\', F.AGGREGATEPATH) = 1
    WHERE F.CREATIONDATE BETWEEN @STARTDATE AND @ENDDATE
    ) THERESULTS
    GO
    /****** Object: StoredProcedure [dbo].[PAGES_SP_FINDWORDFORSELECTEDFOLDERS_V2] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[PAGES_SP_FINDWORDFORSELECTEDFOLDERS_V2]
    @KEYWORD VARCHAR(500),
    @STARTDATE DATETIME,
    @ENDDATE DATETIME
    AS
    SET NOCOUNT ON
    SELECT TOP 5000 * FROM
    SELECT P.PAGENO AS PGNO,FD.FRIENDLYNAME AS FOLDER, F.CREATIONDATE, 'PAGE' AS [TYPE], F.AGGREGATEPATH AS FULLPATH, F.FILESIZE FROM
    CONTAINSTABLE(PAGES, OCRTEXT, @KEYWORD) AS FULLTEXTTABLE
    INNER JOIN PAGES AS P ON P.PAGEID = FULLTEXTTABLE.[KEY]
    INNER JOIN FILES AS F ON F.FILEID = P.FILEID
    INNER JOIN FOLDERS AS FD ON CHARINDEX(FD.PATH + '\', F.AGGREGATEPATH) = 1
    WHERE F.CREATIONDATE BETWEEN @STARTDATE AND @ENDDATE
    UNION ALL
    SELECT NULL AS PGNO, FD.FRIENDLYNAME AS FOLDER, F.CREATIONDATE, 'FILE' AS [TYPE], F.AGGREGATEPATH AS FULLPATH, F.FILESIZE
    FROM
    CONTAINSTABLE(FILES, EPOCALIPSETEXT, @KEYWORD) AS FULLTEXTTABLE
    INNER JOIN FILES AS F ON F.FILEID = FULLTEXTTABLE.[KEY]
    INNER JOIN FOLDERS AS FD ON CHARINDEX(FD.PATH + '\', F.AGGREGATEPATH) = 1
    WHERE F.CREATIONDATE BETWEEN @STARTDATE AND @ENDDATE
    ) THERESULTS
    GO
    /****** Object: StoredProcedure [dbo].[PAGES_SP_GETOCRTEXT] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[PAGES_SP_GETOCRTEXT]
    @PAGENO INT,
    @AGGREGATEPATH VARCHAR(700)
    AS
    SET NOCOUNT ON
    SELECT P.OCRTEXT FROM PAGES AS P
    INNER JOIN FILES AS F ON F.FILEID = P.FILEID
    WHERE F.AGGREGATEPATH = @AGGREGATEPATH AND P.PAGENO = @PAGENO
    GO
    /****** Object: StoredProcedure [dbo].[PAGES_SP_GETOCRTEXTFORALLPAGESOFTHISFILE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROC [dbo].[PAGES_SP_GETOCRTEXTFORALLPAGESOFTHISFILE]
    @AGGREGATEPATH VARCHAR(5000)
    AS
    SELECT PAGES.OCRTEXT FROM PAGES
    INNER JOIN FILES ON FILES.FILEID = PAGES.FILEID
    WHERE FILES.AGGREGATEPATH = @AGGREGATEPATH
    ORDER BY PAGENO
    GO
    /****** Object: StoredProcedure [dbo].[PAGES_SP_INSERTPAGE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[PAGES_SP_INSERTPAGE]
    @OCRTEXT VARCHAR(MAX),
    @FILEID INT,
    @PAGENO INT
    AS
    SET NOCOUNT ON
    INSERT INTO DBO.PAGES (OCRTEXT, FILEID, PAGENO) VALUES (@OCRTEXT, @FILEID, @PAGENO)
    GO
    /****** Object: StoredProcedure [dbo].[PAGES_SP_ISDUPPAGE] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[PAGES_SP_ISDUPPAGE]
    @FILEID INT,
    @PAGENO INT
    AS
    SET NOCOUNT ON
    SELECT PAGENO FROM DBO.PAGES WHERE FILEID = @FILEID AND PAGENO = @PAGENO
    GO
    /****** Object: StoredProcedure [dbo].[usp_RaiseError] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[usp_RaiseError]
    @CustomMessage nvarchar(4000) = ' '
    AS
    -- Exit out if there is no error information to retrieve.
    IF ERROR_NUMBER() IS NULL RETURN;
    DECLARE
    @strErrorMessage NVARCHAR(4000),
    @ErrorNumber INT,
    @Severity INT,
    @ErrorState INT,
    @Line INT,
    @ProcedureName NVARCHAR(200),
    @Msg nvarchar(max);
    -- Store all the error info in some temp variables (not sure why he does this)
    SELECT -- the SELECT keyword apparently means SET in this case.
    @ErrorNumber = ERROR_NUMBER(), -- SETs the value of the @-variable.
    @Severity = ERROR_SEVERITY(), -- SETs the value of the @-variable.
    @ErrorState = ERROR_STATE(), -- SETs the value of the @-variable.
    @Line = ERROR_LINE(), -- SETs the value of the @-variable.
    @ProcedureName = ISNULL(ERROR_PROCEDURE(), '-'),
    @Msg = Error_Message();
    -- Build the message string. The "N" means literal string, and each %d is
    -- a standin for a number, and we'll populate these standins later.
    SET @strErrorMessage = @CustomMessage + N'Error %d, Severity %d, State %d, Procedure %s, Line %d, '
    + 'Message: '+ @Msg;
    RAISERROR (-- This is the built-in RAISEERROR command. Requires 2 vals, then the standin-values
    @strErrorMessage, -- You must supply two values before you can populate the standins
    @Severity, -- first value, required.
    1, -- second value, required
    @ErrorNumber, -- populates a standin
    @Severity, -- populates a standin
    @ErrorState, -- populates a standin
    @ProcedureName, -- populates a standin
    @Line -- populates a standin
    GO
    /****** Object: StoredProcedure [dbo].[usp_RebuildIndexes] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE Procedure [dbo].[usp_RebuildIndexes]
    AS
    Declare @fetch_TableName NVARCHAR(256)
    DECLARE Cursor_Tables CURSOR FOR
    SELECT Name FROM sysobjects WHERE xtype ='U'
    OPEN Cursor_Tables
    While 1 = 1 -- Begin to Loop through all tables
    BEGIN
    FETCH NEXT FROM Cursor_Tables INTO @fetch_TableName -- fetches the next table
    if @@FETCH_STATUS <> 0 break
    print '---------' + @fetch_TableName
    Declare @fetch_indexName NVARCHAR(256) -- loops through al indexes of the current table
    DECLARE Cursor_Indexes CURSOR FOR -- Looking for indexes fragmented more than 15 percent.
    SELECT name as indexName
    FROM sys.dm_db_index_physical_stats (DB_ID(DB_Name()), OBJECT_ID(@fetch_TableName), NULL, NULL, NULL) AS a
    JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id
    Where Name is not null and avg_fragmentation_in_percent > 7
    OPEN Cursor_Indexes
    WHILE 1= 1 -- Begin to Loop through all Indexes
    BEGIN
    FETCH NEXT FROM [Cursor_Indexes] INTO @fetch_indexName
    if @@FETCH_STATUS <> 0 break
    Declare @SqL nvarchar(2000) = N'
    BEGIN TRY
    ALTER INDEX ' + @fetch_indexName + ' ON ' + DB_Name() + '.dbo.' + @fetch_TableName + ' Rebuild
    END TRY
    BEGIN CATCH
    Declare @err nvarchar(2000) = ERROR_MESSAGE();
    throw 51000, @err, 1
    END CATCH'
    Execute sp_executeSQL @sql
    End -- Ends looping through all indexes
    CLOSE [Cursor_Indexes]
    DEALLOCATE [Cursor_Indexes]
    End -- Ends looping through all tables
    CLOSE Cursor_Tables
    DEALLOCATE Cursor_Tables
    GO
    /****** Object: UserDefinedFunction [dbo].[funcSplit] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE function [dbo].[funcSplit](@splitChar varchar(1), @CSV nvarchar(max))
    Returns @Results Table (Value nvarchar(max))
    As
    Begin
    Declare @lastChar nvarchar(1) = substring(@CSV, len(@CSV), 1)
    -- Make sure the string ends in a comma. If not, append one.
    if @lastChar <> @splitChar set @CSV = @CSV + @splitChar
    Declare @posOfComma int = 0
    Declare @LastPosOfComma int = 0
    While 1 = 1
    Begin
    Set @posOfComma = CHARINDEX(@splitChar ,@CSV, @LastPosOfComma)
    if @posOfComma = 0 break
    Declare @Length int = @posOfComma - @LastPosOfComma
    if @Length > 0
    Begin
    Declare @Phrase nvarchar(max) = substring(@CSV, @LastPosOfComma, @Length)
    Insert Into @Results (Value) VALUES (@Phrase)
    end
    set @LastPosOfComma = @posOfComma +1
    if @LastPosOfComma > Len(@CSV) break
    END
    Return
    End
    GO
    /****** Object: Table [dbo].[FILES] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[FILES](
    [AGGREGATEPATH] [varchar](900) NOT NULL,
    [NAMEOFFILE] [varchar](300) NOT NULL,
    [NAMEOFZIPFILE] [varchar](300) NOT NULL,
    [FILEID] [int] IDENTITY(1,1) NOT NULL,
    [CREATIONDATE] [datetime] NOT NULL,
    [EPOCALIPSETEXT] [varchar](max) NOT NULL,
    [DATEADDED] [datetime] NOT NULL,
    [PC] [varchar](30) NOT NULL,
    [FILESIZE] [int] NOT NULL,
    [ZIPPED] [bit] NOT NULL,
    CONSTRAINT [PK_FILES] PRIMARY KEY CLUSTERED
    [FILEID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
    CONSTRAINT [UQ_Files_AggregatePath] UNIQUE NONCLUSTERED
    [AGGREGATEPATH] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
    CONSTRAINT [UQ_Files_FileID] UNIQUE NONCLUSTERED
    [FILEID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[FilesNewLocations] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[FilesNewLocations](
    [AggregatePath] [varchar](900) NOT NULL,
    [NameOfFile] [varchar](300) NOT NULL,
    [NameOfZipFile] [varchar](300) NOT NULL,
    [LocationID] [int] IDENTITY(1,1) NOT NULL,
    [CreationDate] [datetime] NOT NULL,
    [Filesize] [int] NOT NULL,
    CONSTRAINT [PK_FilesNewLocations] PRIMARY KEY CLUSTERED
    [LocationID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
    CONSTRAINT [UQ_FilesNew_AggregatePath] UNIQUE NONCLUSTERED
    [AggregatePath] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[FOLDERS] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[FOLDERS](
    [FOLDERID] [int] IDENTITY(1,1) NOT NULL,
    [PATH] [varchar](900) NOT NULL,
    [FRIENDLYNAME] [nvarchar](500) NULL,
    CONSTRAINT [PK_Folders_Path] PRIMARY KEY CLUSTERED
    [PATH] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
    CONSTRAINT [UQ_Folders_FolderID] UNIQUE NONCLUSTERED
    [FOLDERID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[MISC] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[MISC](
    [BOOLEANCOL] [bit] NULL,
    [KIND] [nvarchar](4000) NULL,
    [STRINGCOL] [nvarchar](4000) NULL,
    [DATECOL] [datetime] NULL,
    [INTEGERCOL] [int] NULL,
    [MISCELLANEOUSID] [int] IDENTITY(1,1) NOT NULL,
    CONSTRAINT [idx_Misc_MiscellaneousID] UNIQUE NONCLUSTERED
    [MISCELLANEOUSID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    /****** Object: Table [dbo].[PAGES] Script Date: 07/29/2014 03:55:24 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[PAGES](
    [OCRTEXT] [varchar](max) NULL,
    [FILEID] [int] NOT NULL,
    [PAGENO] [int] NOT NULL,
    [PAGEID] [int] IDENTITY(1,1) NOT NULL,
    CONSTRAINT [PK_PAGES] PRIMARY KEY CLUSTERED
    [PAGEID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
    CONSTRAINT [UQ_FILEID_PAGENO] UNIQUE NONCLUSTERED
    [FILEID] ASC,
    [PAGENO] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_Files_AggregatePath] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_AggregatePath] ON [dbo].[FILES]
    [AGGREGATEPATH] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_Files_CreationDate] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_CreationDate] ON [dbo].[FILES]
    [CREATIONDATE] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_Files_DateAdded] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_DateAdded] ON [dbo].[FILES]
    [DATEADDED] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_Files_FileSize] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_FileSize] ON [dbo].[FILES]
    [FILESIZE] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_Files_NameOfFile] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_NameOfFile] ON [dbo].[FILES]
    [NAMEOFFILE] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_Files_NameOfZipFile] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_NameOfZipFile] ON [dbo].[FILES]
    [NAMEOFZIPFILE] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_Files_PC] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_PC] ON [dbo].[FILES]
    [PC] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_Files_Zipped] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Files_Zipped] ON [dbo].[FILES]
    [ZIPPED] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_FilesNewLocations_AggregatePath] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_FilesNewLocations_AggregatePath] ON [dbo].[FilesNewLocations]
    [AggregatePath] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_FilesNewLocations_CreationDate] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_FilesNewLocations_CreationDate] ON [dbo].[FilesNewLocations]
    [CreationDate] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_FilesNewLocations_FileSize] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_FilesNewLocations_FileSize] ON [dbo].[FilesNewLocations]
    [Filesize] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_FilesNewLocations_NameOfFile] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_FilesNewLocations_NameOfFile] ON [dbo].[FilesNewLocations]
    [NameOfFile] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [idx_FilesNewLocations_NameOfZipFile] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_FilesNewLocations_NameOfZipFile] ON [dbo].[FilesNewLocations]
    [NameOfZipFile] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [idx_Pages_FileID] Script Date: 07/29/2014 03:55:24 PM ******/
    CREATE NONCLUSTERED INDEX [idx_Pages_FileID] ON [dbo].[PAGES]
    [FILEID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[FILES] ADD DEFAULT ('') FOR [NAMEOFZIPFILE]
    GO
    ALTER TABLE [dbo].[FILES] ADD DEFAULT ('') FOR [EPOCALIPSETEXT]
    GO
    ALTER TABLE [dbo].[FILES] ADD DEFAULT ((0)) FOR [ZIPPED]
    GO
    USE [master]
    GO
    ALTER DATABASE [Year2014_Aug_To_Dec] SET READ_WRITE
    GO

    8A partition function is used when you partition a table. Partitioned tables is a feature that is available only in Enterprise and Developer Edition.
    I went through the script, and there are a number of partition functions and partition schemes, but they are not used anywhere, so you should be able to ignore the error.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Report for pending Excise Invoice

    Hi experts Please suggest me a report which show pending excise invoice, means VF01 has been done but J1IIN is pending. Regards Parkash

  • Urgent !!!!!!! 1099 reporting

    Hello Experts, I am having a problem in 1099 Vendor reporting using the program "RFKQSU20". I was trying to get the list of taxable and non-taxable 1099 amounts by vendor. I was getting a report which has no data in that, even though I posted a vendo

  • Suddenly I cannot access one website

    All of a sudden I cannot access one website at www.countrywalkers.com from any of the three Macs on my network. Two of them are wireless and one is ethernet-cabled I work for them so it would be helpful if I could do so. I e-mailed them and they have

  • Rowtype parameter in stored procedure

    Hi, Trying to call a stored procedure/function in C++ using OCI libs, with ROWTYPE parameter. Any ideas on how to do this? Thanks!

  • Share the view wtih GAF and HTML

    Hello All, I have Benefits enrollement application to be designed such that the screen is shared with GAF and a HTML. The HTML is a page designed and will remain the same through out all the steps in GAF. Please look at the picture attached. The left