Professional Web Applications Themes

This command don't work 'bulk insert' - Microsoft SQL / MS SQL Server

Me.SqlInsertCommand2.CommandText = "BULK INSERT [ [ 'Mink'.] [ 'TBL_Catalog' ].] { 'TBL_Catalog' FROM 'c:\Catalog1.bcp'" What is wrong with the syntax of this? Trint .Net programmer com *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!...

  1. #1

    Default This command don't work 'bulk insert'


    Me.SqlInsertCommand2.CommandText = "BULK INSERT [ [ 'Mink'.] [
    'TBL_Catalog' ].] { 'TBL_Catalog' FROM 'c:\Catalog1.bcp'"
    What is wrong with the syntax of this?
    Trint



    .Net programmer
    com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Trint Guest

  2. #2

    Default Re: This command don't work 'bulk insert'

    Get a command working in Query yzer first, then move it to your
    application. Much easier to debug.

    The doentation for the BULK INSERT statement, including switches,
    samples, and valid syntax, is here:

    http://msdn.microsoft.com/library/en-us/tsqlref/ts_ba-bz_4fec.asp




    "Trint Smith" <com> wrote in message
    news:e#phx.gbl... 


    Aaron Guest

  3. #3

    Default Re: This command don't work 'bulk insert'

    Other than the missing closing '}', the file you specify must be accessible
    from the SQL Server machine, not your local machine. So that would mean
    that Catalog1.bcp would be on the C: drive of your SQL Server.. if you want
    to insert from your machine, dump it on a share, and use a UNC path instead.

    Check the BOL for information on this.

    "Trint Smith" <com> wrote in message
    news:e%phx.gbl... 


    Curtis Guest

  4. #4

    Default Re: This command don't work 'bulk insert'

    i know:
    SqlInsertCommand2.CommandText = "BULK INSERT 'Mink'.'TBL_Catalog'.{
    'TBL_Catalog' FROM '\\Server05\c$\Catalog1.bcp'"
    it still don't work though.
    thanks,
    Trint

    .Net programmer
    com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Trint Guest

  5. #5

    Default Re: This command don't work 'bulk insert'

    If you need to enclose identifiers, you'll need to use either double
    quotes or brackets in SQL Server. Single quotes are used to enclose
    constants. For example:

    BULK INSERT [MyDatabase].[MyOwner].[MyTable]
    FROM '\\Server05\c$\Catalog1.bcp'

    BULK INSERT "MyDatabase"."MyOwner"."MyTable"
    FROM '\\Server05\c$\Catalog1.bcp'

    Also, note that the SQL Server service account will need to be a member
    of the local administrators group on Server05 because you are using the
    administrative (c$) share.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    -----------------------
    SQL FAQ links (courtesy Neil Pike):

    http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
    http://www.sqlserverfaq.com
    http://www.mssqlserver.com/faq
    -----------------------

    "Trint Smith" <com> wrote in message
    news:u%phx.gbl... 


    Dan Guest

  6. #6

    Default Re: This command don't work 'bulk insert'

    Dan,
    This does help...thanks,
    Trint

    .Net programmer
    com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Trint Guest

  7. #7

    Default Re: This command don't work 'bulk insert'

    Dan,
    One last thing...Would it exicute like this?

    BULK INSERT [MyDatabase].[MyOwner].[MyTable]
    FROM '\\Server05\c$\Catalog1.bcp'
    SqlInsertCommand2.ExecuteNonQuery()
    Thanks,
    Trint



    .Net programmer
    com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Trint Guest

  8. #8

    Default Re: This command don't work 'bulk insert'

    Dan,
    is underscore "_" end of line or what does that mean? and is [myowner]
    the same thing as [mytable]?
    thanks,
    Trint

    com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Trint Guest

  9. #9

    Default Re: This command don't work 'bulk insert'

    "_" denotes a string continuation on the next line. "myowner" is not the
    same as "mytable".

    Basically, Dan's trying to show you the syntax using the 3-partname that is
    used by Bulk Insert.

    Would this make it easier to understand...

    'VB.NET
    With SqlInsertCommand2
    .CommandText = "BULK INSERT [MyDatabase].[MyOwner].[MyTable] FROM
    '\\Server05\c$\Catalog1.bcp'"
    .CommandType = CommandType.Text
    .ExecuteNonQuery()
    End With

    --
    -oj
    Rac v2.2 & QALite
    http://www.rac4sql.net


    "Trint Smith" <com> wrote in message
    news:phx.gbl... 


    oj Guest

  10. #10

    Default Re: This command don't work 'bulk insert'

    Like oj said, the underscore is simply the VB continuation character.
    Sorry about the confusion but I though text wrapping might make it
    harder to read.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    -----------------------
    SQL FAQ links (courtesy Neil Pike):

    http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
    http://www.sqlserverfaq.com
    http://www.mssqlserver.com/faq
    -----------------------

    "Trint Smith" <com> wrote in message
    news:phx.gbl... 


    Dan Guest

  11. #11

    Default Re: This command don't work 'bulk insert'

    oh,
    so...it would be:

    With SqlInsertCommand2
    .CommandText = "BULK INSERT [Mink].[dbo].[TBL_Catalog] FROM
    '\\Server05\c$\Catalog1.bcp'"
    .CommandType = CommandType.Text
    .ExecuteNonQuery()
    End With

    the owner is visible in the sql query yzer under tables on the
    object browser...right?

    Mink
    |
    user tables
    |
    dbo.TBL_Catalog
    etc...

    Trint




    ..Net programmer
    com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Trint Guest

  12. #12

    Default Re: This command don't work 'bulk insert'

    Correct.

    --
    -oj
    Rac v2.2 & QALite
    http://www.rac4sql.net


    "Trint Smith" <com> wrote in message
    news:phx.gbl... 


    oj Guest

Similar Threads

  1. BULK INSERT
    By sampsas23 in forum Coldfusion - Getting Started
    Replies: 10
    Last Post: January 12th, 01:50 PM
  2. Bulk Insert
    By Mirza in forum Microsoft SQL / MS SQL Server
    Replies: 5
    Last Post: August 8th, 12:25 PM
  3. more description of why i need bulk insert command for vb?
    By Trint in forum Microsoft SQL / MS SQL Server
    Replies: 5
    Last Post: August 6th, 01:03 AM
  4. bulk insert command for vb?
    By Trint in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: August 5th, 03:42 PM
  5. BULK INSERT exercises from exam 70-229 training kit don't work
    By gene in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: July 14th, 12:00 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139