Home » SQL Server

SQLState=S1000, NativeError=0

I am trying to use the BCP command to execute the following statement, but I keep getting the following error:

Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Unexpected EOF encountered in
BCP data-file

0 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1

This is a very small XML file and here are it's contents:

<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
<s:Schema id='RowsetSchema'>
 <s:ElementType name='row' content='eltOnly'>
  <s:AttributeType name='c0' rs:name='WITHDRAWAL-CODE' rs:number='1'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='6' rs:maybenull='false'/>
  <s:AttributeType name='c1' rs:name='WITHDRAWAL-SDESC' rs:number='2' rs:nullable='true'>
   <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='30'/>
  <s:extends type='rs:rowbase'/>
 <z:row c0='00' c1='00 Withdrawn pr'/>
 <z:row c0='01' c1='01 Change grade'/>
 <z:row c0='02' c1='02 Trans-pubSam'/>
 <z:row c0='03' c1='03 Trans-nonpub'/>
 <z:row c0='04' c1='04 Moved out of'/>
 <z:row c0='05' c1='05 Moved out of'/>
 <z:row c0='06' c1='06 Left-age wit'/>
 <z:row c0='07' c1='07 Left-age wit'/>
 <z:row c0='08' c1='08 Grad'/>
 <z:row c0='09' c1='09 Grad-met IEP'/>
 <z:row c0='11' c1='11 Died'/>
 <z:row c0='12' c1='12 Excused-disa'/>
 <z:row c0='13' c1='13 Commit to co'/>
 <z:row c0='14' c1='14 Withdrawn 15'/>
 <z:row c0='15' c1='Lft Marriage'/>
 <z:row c0='16' c1='16 Expelled'/>
 <z:row c0='17' c1='Left sch Pregna'/>
 <z:row c0='18' c1='18 Withdrawn no'/>
 <z:row c0='20' c1='20 Transfer did'/>
 <z:row c0='21' c1='21 EC Withdrawa'/>
 <z:row c0='22' c1='22 Entered care'/>
 <z:row c0='23' c1='23 Kindergarten'/>
 <z:row c0='24' c1='24 Homebound'/>
 <z:row c0='25' c1='25 EC eval only'/>
 <z:row c0='26' c1='26 EC withdrawa'/>
 <z:row c0='27' c1='27 EC transitio'/>
 <z:row c0='28' c1='Not eligile 3yr'/>
 <z:row c0='29' c1='Not elig for 3y'/>
 <z:row c0='30' c1='3yr elig not de'/>
 <z:row c0='31' c1='31 Left -social'/>
 <z:row c0='32' c1='32 Left - finan'/>
 <z:row c0='33' c1='33 Left - famil'/>
 <z:row c0='34' c1='34 Left-Unknown'/>
 <z:row c0='35' c1='35 Left-Over 21'/>
 <z:row c0='36' c1='enrol post seco'/>
 <z:row c0='37' c1='37 Left- to GED'/>
 <z:row c0='40' c1='40 EOY Enrolled'/>
 <z:row c0='41' c1='41 Dropped/ReEn'/>
 <z:row c0='42' c1='42  met loc gra'/>
 <z:row c0='50' c1='50 Special ed s'/>
 <z:row c0='60' c1='No Referal'/>
 <z:row c0='61' c1='Referal to SpEd'/>
 <z:row c0='62' c1='Refer HealthCar'/>
 <z:row c0='63' c1='Refer SpEd/Heal'/>
 <z:row c0='64' c1='Refer EC Progam'/>
 <z:row c0='65' c1='Refer Parent No'/>
 <z:row c0='97' c1='Displaced NonRe'/>
 <z:row c0='99' c1='99 Enrollment S'/>
 <z:row c0='WCV' c1='DO NOT USE'/>
 <z:row c0='YE' c1='DO NOT USE'/>



And this is my SQL table in the Development database which is currently empty:

CREATE TABLE wbl_Load (xCol xml);

I am not using a format file but here is what I choose from the command prompt:




Hi folks,

bcp is giving me a strange error, which I cannot solve by myself. I tried to Google it without any success.

Interestingly, it works on my local machine but it does not work on others :)


Now the details. I need to bulk insert some data into the database. The challenge is that two tables have to be updated at the same time, as they are linked with one-to-one relationship. The first table's primary key is also an identity field. The second table's primary key should get the value, assigned by SQL to the first table's identity key.

So we have:

Table1( ID1(Primary, Identity), Value1)  Table2( ID2(Primary), Value2)

Input data set: (Value1, Value2)

10, 100

20, 200



After insert the tables values should be...

Table1                      Table2


1010, 10                   1010, 100

1011, 20                   1011,200

1012, 30                   1012,300

1010-1012 are the identity values assigned by SQL

We cannot target two tables in bcp, but we can target a view,
So I created a view (MyView), linking ID1 and ID2, and having two fields Value1 and Value2
now, after issuing... bcp pubs.dbo.MyView in my.txt -T -c -t ,
I am getting the following error
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]View or function 'pubs.dbo.MyView' is not
 updatable because the modification affects multiple base tables.

After bit of research, I have created a INSTEAD OF INSERT TRIGGER to catch the insert statement and redirect it to two separate statements, updating each table separately. My two insert statements look like the following...
insert into Table1 (Value1) select i.Value1 from inserted i
insert into Table2 (ID2, Value2) select scope_identity(), i.Value2 from inserted  i 
The scope_identity() function eventually returns me ID1 assigned to the first table.

The problem with those statements is that the trigger is called once, for the whole table (inserted), not per each row. So it fails, as it tries to use the same (last ID1) value for all the values of the Table2.

To solve this problem (thanks to article http://support.microsoft.com/kb/111401 ) I am using cursoring (iterating).
as I cannot use DELETE approach for 'inserted' table I am using slightly modified second approach.
However, for that to work, I modified a view to be View (ID1,Value1,Value2)
My input file would become

Note, that the only requirement to the first column, is that values must be in the ascending order.
My final trigger is...

CREATE TRIGGER MyTrigger on [dbo].[MyView]

DECLARE @row_id CHAR( 11 )
SELECT @row_id = i.ID1 from inserted i

WHILE @row_id is not null
INSERT INTO dbo.Table1 (Value1) SELECT i.value1 FROM inserted i WHERE i.ID1 = @row_id

INSERT INTO dbo.Table2 (ID2, Value2) SELECT scope_identity(), i.Value2 FROM inserted  i WHERE i.ID1 = @row_id

    SELECT @row_id = min( i.ID1 ) FROM inserted i WHERE i.ID1 > @row_id

I tested this approach on my machine and it works great either using bcp.exe utility, or BULK INSERT operator, such as
bulk insert MyView from 'c:\my.txt' with (FIELDTERMINATOR = ',', FIRE_TRIGGERS )

bcp commands are: (either works on my machine)

bcp pubs.dbo.MyView in C:\my.txt  -c  -T -t , -h "FIRE_TRIGGERS"
bcp pubs.dbo.MyView in C:\my.txt  -c  -S peterv21855 -Usa -Psa -t , -h "FIRE_TRIGGERS"

Note: we must specify -h "FIRE_TRIGGERS" option to hint a system to use the trigger. 

I was so excited about my solution, so I quickly embed it in our system and fired up the test run. Unfortunately it did not go well on real tables on different database (different server).

I went back to my test files and this time I created them on different machine. 
Strangely it did not work. I run the bcp command from that remote machine to update my test files on my machine- that worked perfectly. So bcp was not an issue. I run bcp -v and the versions were the same (Version: 8.00.194, MSSQL 2005)

The error I am getting is the following:

Starting copy...
SQLState = 37000, NativeError = 8105
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]'My_DB.dbo.MyView' is not a user table. Cannot perform SET operation.
BCP copy in failed

The only thing that differ is that my test files are under pubs database.
I run bcp with sa credentials, and with other user name (with all possible permissions, including bulkadmin and sysadmin)
Nothing helps. I did not find anything in MSDN or in Google.
The only hope is this forum.
Please help.




Im Executing bcp <databasename.schema.tablename> out <destination file> -T -c but the result is always to export data from a table to a flat txt file

SQLState = S0002, NativeError = 208 Error =[Microsoft][Sql server native client 10.0][sql sevrer]Invalid object name 'database.schema.table'

Inspite of the fact that I provide an exact full table name that exists effectively within my server instance

Im running sql server 2008 32 bit in a windows server 2008 32 bit machine



The complexity resides in the simplicity


Could you help on how to catch the NativeError number from exception in T-SQL


I want to catch the SQLState and NativeError numbers in my Stored Procedure.

I am able to get the SQLState number using ERROR_NUMBER() function.

But I didn’t get any fucntion to catch the NativeError number.



Thanks & Regards,



Does anyone know how to suprime
the error message [SQLSTATE01000} that comes at the end of a Print line?
Thank you.


We have an application that connects to SQL 2005 thru ODBC with the following string:

driver=SQL Server;server=server1;database=db2005;uid=serveruser;pwd=pwd1;

When our administrators login on the workstation the application works well. But when ordinary users login they get the following error. (We only have 1 domain)

SQLState: 28000

SQL Server Error: 18452

Login failed for user ". The user is not associated with a trusted SQL Server connection.

Then the standard SQL Server Login window pops up asking for the Login ID and Password. On the window the 'Use Trusted Connection' is checked and the name of the user on the workstation appears on the LoginID. What we do is uncheck the 'Use Trusted Connection' then login using the credentials above.

Need help on this one please. Thanks.



I am developing a website in php. My back end is sql server 2008. when i am trying to insert something through php, i get the following error code.

Error in executing the query. Array([0] => (Array[0] => 42000 [SQLSTATE] => 42000 [1]  => 8114 [CODE] Error converting datatype to numeric.

But, I am able to insert other data into the sql server. Can you please help me out with this?


Thank you.


I am a Power Buidler developer using PowerBuilder version 11.2 which connect to MS Server using SQL Native Client. I got this error yesterday in one of our Production Applications:


Please advise how I can resolve this issue. Is there a driver that I can download? or ...?
Your quick reply is really highly appreciated.



I'm having trouble running jobs with my active directory (ADS) account. I've setup my SQL services to run under an ADS account, but jobs cannot seem to query ADS for user information. We're running Windows Server 2003 and SQL Server 2005 SP2.

 Here is the error message:


The job failed.  Unable to determine if the owner (ADS\me) of job eFASRtest has server access (reason: Could not obtain information about Windows NT group/user 'ADS\me', error code 0x5. [SQLSTATE 42000] (Error 15404)).


also this message in log:


[298] SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'ADS\me, error code 0x5. [SQLSTATE 42000] (ConnIsLoginSysAdmin)


I already tested the suggested:

execute as login='ads\me' and I get the same error on both (my local installations and production)

appreciate your help

i can't connect to sql server 2005 express. i install in windows xp
In what circumstances do we get the below error. Shouldn't it be a little more descriptive?

The statement has been terminated. [SQLSTATE 01000]

This is for an SQL SERVER 2005 SP2. I am running a rebuild index using a TSQL job. The rebuild runs fine for a while giving this error later.

I Am Continiously Getting Error For Following Line Of Code, It Work  Fine In Other Database

Am I Doing Any Mistake

if (sh3itno != "" && dpsh3no != "")
                string queryy = "SELECT [CHEQNO] FROM [SH3MAST] WHERE (([CHEQDATE] = " + chqdate + ") AND ([FAVOUR] = " + favour + ") AND ([CHQTYPE] = " + ctype + ") AND ([TRSTN] = " + trstn + ") AND ([TRBANK] = " + trbank + ") AND ([SH3ITNO] = " + sh3itno + ") AND ([DPSH3NO] = " + dpsh3no + "))";
                OdbcCommand cmd3 = new OdbcCommand(queryy, connen1);
                string chqno =cmd3.ExecuteScalar().ToString(); (Here Iam Getting Error)
                tbl.Rows[i]["cheque no"] = chqno;
Stack Trace: 

[OdbcException (0x80131937): ERROR [S1000] [Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).]
   System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) +39
   System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) +1135
   System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) +53
   System.Data.Odbc.OdbcCommand.ExecuteScalar() +76
   Allotmentdetail.gridres() in g:\CDA\passedbill.aspx.cs:221
   Allotmentdetail.display_Click(Object sender, EventArgs e) in g:\CDA\passedbill.aspx.cs:75
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +78
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +100
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2863


Please Help Me!!!
Its Urgent



I have created a Job which will run the script generated by LiteSpeed for a particular DB Restore. However when i run the job, it is failing with the following error:

The job failed.  Unable to determine if the owner (REDMOND\v-kamir) of job Restore_Job has server access (reason: Could not obtain information about Windows NT group/user 'REDMOND\v-kamir', error code 0x5. [SQLSTATE 42000] (Error 15404)).

I ran the script through SSMS and it works fine. Any ideas how to fix this?



I get this error on my web page whenever i keep open some applications. I browsed through some links which say that it could be a network issue. Though I havn't received any convincing answer though. Any idea why this happens?

I've received this error twice over 2 days in the SQL Agent error log during off-hours from a server which has not had any changes to it in the last few months (once at 3:32AM and the next day at 3:46AM.  I've been able to tie it to log-shipping backup jobs (all of which run under the SQL Service domain account) which run every minute.  It seems to be only momentary, as the next attempt a minute later is successful.

I get the same set of messages for each database for the same time which look like this:

Date  07.03.2008 3:31:51 AM
Log  SQL Agent (Current - 10.03.2008 6:15:00 PM)

[298] SQLServer Error: 258, TCP Provider: Timeout error [258]. [SQLSTATE 08001]

Date  07.03.2008 3:31:52 AM
Log  SQL Agent (Current - 10.03.2008 6:15:00 PM)

[165] ODBC Error: 0, Login timeout expired [SQLSTATE HYT00]

Date  07.03.2008 3:31:52 AM
Log  SQL Agent (Current - 10.03.2008 6:15:00 PM)

[298] SQLServer Error: 258, Unable to complete login process due to delay in login response [SQLSTATE 08001]

Date  07.03.2008 3:31:52 AM
Log  SQL Agent (Current - 10.03.2008 6:15:00 PM)

[382] Logon to server '(local)' failed (SubSystemStepHistoryLogger)

I can't find any documentation on these errors on the web or MSDN site.  Can I chalk this up to possibly "winking" connection to our domain controller?  We've never had these messages before, and our LAN department swears that there have been no upgrades to the network or domain controller servers recently.


       I have scheduled a job which stops trace, collects all events into a temp table, restarts the trace.  Since long the job is failing with the below error message.

Executed as user: xxxx\svc.MSSQLSRV. Could not find the requested trace. [SQLSTATE 42000] (Error 19059).

Can someone help me on resolving this issue?

Thanks In Advance


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure