Invalid string or buffer length!!!!

  • I am reading a text file into a temptable, then opening a cursor to read through the temptable.

    When i execute my procedure from SQL server, all is fine, but when i do it throught another application that calls the procedure, i get the error:

    ODBC Driver -  S1090  -

    Invalid string or buffer length

    i really dunno how to solve that especially that when i run it alone it works!

    declare

    @oneline varchar(8000)

    CREATE

    TABLE #textfile (line varchar(8000))

    BULK INSERT #textfile FROM 'D:\websites\neolane\www\Import\init_newsl.txt'

    DECLARE table_cursor CURSOR FOR SELECT line FROM #textfile

    OPEN table_cursor

    FETCH NEXT FROM table_cursor INTO @oneline

    IF (@@FETCH_STATUS = -1)

    -- my code

    END

     

    ...... help please!!!!

  • What is the driver you are using? I would review this first.

  • the thing is that I am executing the procedure through an application that automatically connects, and I cannot choose the connection type...

    Does that mean a dead end???

  • Right, but if you know what driver the connection is using you can find out if it is the driver has a bug or an updated version then update the driver or procedure accordingly.

  • what i did is that i changed the way of calling the procedure from

    Go

    exec dbname..sp_importNewsletter

    Go

     

    to

    use dbname

    Go

    exec sp_importNewsletter

    Go

     

    apparently the user in the application is not a dbo. The previous error is gone but another one appeared saying that i cannot use BULK INSERT

    so now i have to know how to give the right to that user to use bulk insert while i dont even know what user it is!!! arghhhhh

  • On a side not I would also review using "sp_" when writing user procedures as far as a small cost in performance with contect switching, proc cache hit ratio, etc...

  • well am not very pro in that, i didn't quiet understand what u mean by not using sp_

    what would that change in the fact that the user doesnt have the right to execute that command throught the application

  • you can see what user is executing the sp using sql profiler. Set that up then run the app find the user and give it bcp rights

    www.sql-library.com[/url]

  • This article talks about sp_ and procedure cache and the impact.

    http://qa.sqlservercentral.com/columnists/bkelley/procedurecache.asp

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

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