BCP and #Tables

  • Hi.

    I've got a proc that sometimes takes over 2 minutes to execute, and I'm calling it from a VB6 app. Problem is this makes my app synchronous (all execution must wait for the proc to finish). I then used bcp, however bcp doesn't like local temp tables (since my proc has one). How can I go around this as I'd like to use bcp since it makes my app asynchronous.

  • You need to use a global temp table i.e prefix ##

    Look up "bcp utility, copying data to or from temporary tables" in BOL

    Simon Sabin

    Co-author of SQL Server 2000 XML Distilled

    http://www.amazon.co.uk/exec/obidos/ASIN/1904347088


    Simon Sabin
    SQL Server MVP

    http://sqlblogcasts.com/blogs/simons

  • Why do you use #Temp tables. YOu may also get a performance boost by creating a table and having the data load into that. Then you could apply indexes etc.... Be careful though if you do apply the indexes to drop them then insert and then re-create (faster execution). This way you don't lock the tempdb.

    Another method you may want to research is to use Linked_Servers. This way you can build a schema.ini file which will tell the SQL Server what the field names/data-types are. This would also increase performance.

    Just some thoughts.

    Thanks,

    AJ

    AJ Ahrens

    SQL DBA

    Custom Billing AT&T Labs



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

Viewing 3 posts - 1 through 2 (of 2 total)

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