HOW TO USE DBCC COMMAND FOR SCRIPT TABLE

  • HI

    I want to script a table with data using query wise.

    if its having any possible to script the table with data

    using dbcc commands.....:-)

  • There are no DBCC commands to script tables out.

    Scripting out data is fairly easy, just query the table and build insert statements. That said, if you're over a few MB, probably easier to bcp the data out.

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • You can downoad and install ssms tools (www.ssmstoolspack.com).

    It has a handy feature to help you script out data in a table as Insert Statements.

    But, as mentioned, if you are dealing with large tables, bulk copying it out to a file will be faster and

    more efficient.

  • Thanks friends

    for ur

    kind replay

  • hi friends

    i have another one question

    how to use " bcp in " command...

    i want import data form a csv file

    i used this cmd to import:

    DECLARE @bcp_cmd VARCHAR(8000)

    SET @bcp_cmd = 'bcp [DB_name].[dbo].[Table_name] in "d:\Test.CSV" -c -T -S ' + @@servername

    EXEC @bcp_cmd

    but its showing some error:

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near '.'.

    how to solve this problem......:-)

  • Start by reading the Books Online entry for bcp... Take special note of what kind of command it is (ie where it runs)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • And while you are looking at BCP, you may also want to look at BULK INSERT.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply