Click here to Skip to main content
15,895,084 members
Articles / Desktop Programming / Win32

SQL Class Shell Generator

Rate me:
Please Sign up or sign in to vote.
4.87/5 (65 votes)
8 Jan 2009CPOL6 min read 220.3K   3.3K   233  
Generate class shells from SQL Server database tables, (SQL 2005 & 2008 only). Output languages supported: C# and VB.NET.
Public Enum FileState As Integer
    
    'Hex value is: 00000000
    <Description("The file is available for all operations. Files in the primary filegroup are alwa"& _ 
        "ys online if the database itself is online. If a file in the primary filegroup i"& _ 
        "s not online, the database is not online and the states of the secondary files a"& _ 
        "re undefined.")>  _
    ONLINE = 0
    
    'Hex value is: 00000001
    <Description("The file is being restored. Files enter the restoring state because of a restore "& _ 
        "command affecting the whole file, not just a page restore, and remain in this st"& _ 
        "ate until the restore is completed and the file is recovered.")>  _
    RESTORING = 1
    
    'Hex value is: 00000002
    <Description("The file is being recovered.")>  _
    RECOVERING = 2
    
    'Hex value is: 00000003
    <Description("The recovery of the file has been postponed. A file enters this state automatical"& _ 
        "ly because of a piecemeal restore process in which the file is not restored and "& _ 
        "recovered. Additional action by the user is required to resolve the error and al"& _ 
        "low for the recovery process to be completed. For more information, see Performi"& _ 
        "ng Piecemeal Restores.")>  _
    RECOVERY_PENDING = 3
    
    'Hex value is: 00000004
    <Description("Recovery of the file failed during an online restore process. If the file is in t"& _ 
        "he primary filegroup, the database is also marked as suspect. Otherwise, only th"& _ 
        "e file is suspect and the database is still online. The file will remain in the "& _ 
        "suspect state until it is made available by one of the following methods: Restor"& _ 
        "e and recovery or DBCC CHECKDB with REPAIR_ALLOW_DATA_LOSS")>  _
    SUSPECT = 4
    
    'Hex value is: 00000006
    <Description("The file is not available for access and may not be present on the disk. Files be"& _ 
        "come offline by explicit user action and remain offline until additional user ac"& _ 
        "tion is taken. Caution: A file should only be set offline when the file is corru"& _ 
        "pted, but it can be restored. A file set to offline can only be set online by re"& _ 
        "storing the file from backup. For more information about restoring a single file"& _ 
        ", see RESTORE (Transact-SQL).")>  _
    OFFLINE = 6
    
    'Hex value is: 00000007
    <Description("The file was dropped when it was not online. All files in a filegroup become defu"& _ 
        "nct when an offline filegroup is removed.")>  _
    DEFUNCT = 7
End Enum

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Denmark Denmark

Comments and Discussions