Results 1 to 4 of 4

Thread: SQL Script generation from table/database

  1. #1
    Wilson Guest

    SQL Script generation from table/database


    Have any Methods which can generate a SQL script file from a table or database. This script file consists of the Table/database structure and the data. This data is backup by a number of "insert" syntax code and so on ...
    Thanks!!!!

  2. #2
    Craig Guest

    SQL Script generation from table/database (reply)

    Enterprise manager can script any objects on your database.

    See books online.


    ------------
    Wilson at 4/5/00 1:49:26 AM


    Have any Methods which can generate a SQL script file from a table or database. This script file consists of the Table/database structure and the data. This data is backup by a number of "insert" syntax code and so on ...
    Thanks!!!!

  3. #3
    wilson Guest

    SQL Script generation from table/database (reply)

    I know Enterprise manager can script any objects on my database. But, as I have known, it cannot to script the data in the table. I want to backup the data in the table by a number of "insert" syntax.
    Thanks!!!


    ------------
    Craig at 4/5/00 7:38:56 AM

    Enterprise manager can script any objects on your database.

    See books online.


    ------------
    Wilson at 4/5/00 1:49:26 AM


    Have any Methods which can generate a SQL script file from a table or database. This script file consists of the Table/database structure and the data. This data is backup by a number of "insert" syntax code and so on ...
    Thanks!!!!

  4. #4
    jeriah Guest

    SQL Script generation from table/database (reply)


    A little late, but maybe helpful...

    Use a cursor to capture all the user tables, then use xp_cmdshell and bcp to bcp the data out...

    Code sample

    create table #tables
    (name varchar(255))
    INSERT INTO #tables
    SELECT NAME
    FROM sysobjects
    where type = 'U'

    .....


    SELECT @cmdline = 'bcp ' + @dbname + '..' + @tablename + ' out ' + @path + '' + @tablename + '.dat -c -t~ -T'

    EXEC master..xp_cmdshell @cmdline, NO_OUTPUT




    ------------
    at 4/12/00 10:58:24 PM

    I know Enterprise manager can script any objects on my database. But, as I have known, it cannot to script the data in the table. I want to backup the data in the table by a number of "insert" syntax. Have any method to create a sql file which has a numbere of "insert" syntax to backup the data in a table. Also, how to create a trigger to update the sql file when the data in the table is updated.
    Thanks!!!


    ------------
    wilson at 4/5/00 8:48:19 AM

    I know Enterprise manager can script any objects on my database. But, as I have known, it cannot to script the data in the table. I want to backup the data in the table by a number of "insert" syntax.
    Thanks!!!


    ------------
    Craig at 4/5/00 7:38:56 AM

    Enterprise manager can script any objects on your database.

    See books online.


    ------------
    Wilson at 4/5/00 1:49:26 AM


    Have any Methods which can generate a SQL script file from a table or database. This script file consists of the Table/database structure and the data. This data is backup by a number of "insert" syntax code and so on ...
    Thanks!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •