Backup/dump of a selected tables.

GumlegufGumleguf Member Posts: 38
edited 2009-07-06 in SQL General
We have seen an issue where an index in a table was destroyed. We were able to use Navision anyway, but we were having real problems rebuilding the indexes.

I have previously worked some with MYSQL and there is this brilliant feature MYSQLDUMP. What is does is basically dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to create the table, populate it, or both.

I am looking for a similar feature or query that will help me do the same on a MS SQL2005. Anyone?

Comments

  • strykstryk Member Posts: 645
    Well, I guess you want such scripts to re-create an objects ...
    You could do this in SQL Server Management Studio, e.g. by "right-clicking" on the onject (table, index, etc.) and chsoose "Create Script ..." and then ".. for CREATE" (or INSERT, SELECT, etc.) ...

    But I think you should focus on the real problem: how was the index destroyed? A msitake from a user/admin? How comes?
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • GumlegufGumleguf Member Posts: 38
    Yes, this shows how for instance a table is designed, but I'm looking for a script that will basically show a CREATE but also provide me with data from the table. Sort of a very low level backup of a single table. Hope it makes sense what I'm trying to achieve here... :?:

    We don't know how the index was destoyed. We are not hosting/maintaning the database - we are just trying to "recover" Navision.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Create a Navision native FBK backup and restore into a new database.
    David Singleton
  • strykstryk Member Posts: 645
    As far as I know there is no standard features which generates a TSQL script to INSERT the actual data - you could get templates for the table-structure, but not for the "content" ...

    So, a normal SQL Backup in this case is insufficient, bacause this would also contain the corrupt index, right? So maybe you want to "replicate" the data into another database, maybe on a remote server. You could also use SSIS packages to accomplish this.

    For example, in SSMS you could right-click on the DB, then choose "Tasks" and "Export" ... (here you also find a "Script" task!) ...
    Jörg A. Stryk (MVP - Dynamics NAV)
    NAV/SQL Performance Optimization & Troubleshooting
    STRYK System Improvement
    The Blog - The Book - The Tool
  • kinekine Member Posts: 12,562
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • GumlegufGumleguf Member Posts: 38
    Thanks all. I'll look into your suggestions.
Sign In or Register to comment.