Showing posts with label thru. Show all posts
Showing posts with label thru. Show all posts

Friday, March 23, 2012

Problems creating Error File when using Bulk Insert or BCP from xp_cmdshell.

BCP thru xp_cmdshell from stored procedure:

EXEC sp_configure 'show advanced options', 1;

RECONFIGURE

EXEC sp_configure 'xp_cmdshell', 1;

RECONFIGURE

EXEC xp_cmdshell 'bcp database.dbo.table in c:\scheduled.csv -S SERVER\SQLEXPRESS -T -t, -r\n -c -e "error.txt"';

This is returning the following error code. I even tried placing the command in a seperate command file and calling that with no success. If I run this from the command line the error file generation does work.

=================================================================

SQLState = HY000, NativeError = 0

Error = [Microsoft][SQL Native Client]Unable to open BCP error-file

=================================================================

Error message when using BULK INSERT as follows:

BULK INSERT database.dbo.table from 'c:\unscheduled.csv' with

(FIELDTERMINATOR = ',', ERRORFILE = 'c:\error.txt');

Returns the following error message:

=================================================================

Msg 4861, Level 16, State 1, Procedure pro_cedure, Line 9

Cannot bulk load because the file "c:\error.txt" could not be opened. Operating system error code 80(The file exists.).

Msg 4861, Level 16, State 1, Procedure pro_cedure, Line 9

Cannot bulk load because the file "c:\error.txt.Error.Txt" could not be opened. Operating system error code 80(The file exists.).

=================================================================

The Bulk Insert actually creates a empty error.txt file (0kb) and never preforms the insert, I can not find any examples of anyone using the -ERRORFILE switch on BULK INSERT. Prolly some default security setting to allow file creation/modification I am missing. Anyone help me out? Thanks.

EDIT: SQL SERVER EXPRESS 2005 - WINXP PRO SP2

I had this error too. It looks like a bug as BULK INSERT works fine without the -ERRORFILE option. It seems that the execution of the BULK INSERT first creates the file without closing it which results in the error message afterwards. As Workaround just don't use the option

Nobsay

Wednesday, March 21, 2012

Problems connecting thru firewall

I have developed an application that handles data from a SQL server runnig inside my main domain.

When i connect with the SQL server from the inside i have no problems at all.

However we opened up the application (smart client application) for some beta testers and i bumped into some problems. i changed the connectionstring to use the IP for the server. I also tried a registered dns name, but i got the following

The aspnetdb i use for authentication is refusing to run the stored procedures and i get the famous disconnected due to the remote server does not accept remote calls, or something like that.

If i disable the Authentication in the application and just run the application with the same connectionstring IP or DNS, parts of the application works. Some of the stored procedures get executed , and the others does not get executed.

I have looked at the owner of the items but they all have the same owner and exec rights. I have checked my C# code and they are all using the patterns to execute the calls the same way.

Does anyone have any idea whats going on here ?

I also confirmed that the correct SQL ports has been opened in the PIX.
I ran home and tried to connect the sql server managment studio from home and i got access , the application still behaves like before

how about using a sql server mixed mode for authentication.|||

Hi

The SQL server is set to mixed mode security and i'm using a SQL login i created with dbo schema.

|||

is the server configured to accept local and remote connection

in the surface configuration

start>programs> sqlserver2005>

configuration tools>surface area configuration>

configuration for service and connection>datbase engine

>remote connection> check local and remote connection

|||

Thanks for your answer

I found the problem last night. In the solution someone had added a SQL report that had a hardcoded connectionstring. The try catch found the connection issue and then skipped parts of the load of the application.

Once i removed the conn string everything is working fine...

Monday, March 12, 2012

Problems (re)installing SQL Server 2005 in WinXP pro

I am attempting to install the Standard edition on a WinXP pro laptop that apparently had this installed before I got it. I Removed, thru Add/Remove, everything related to SQL Server. When I tried to do a fresh install of DB Services, Integration Services and Client tools, Setup Support and the Native Client seems to install ok, the directories get created and some files are put there. The installer stops and sez that the Databases Services and the Workstation Components are already installed, the Details button tells me that the only available option are thru the Add/Remove Programs. There are no entries for the Server or Client Tools on Add/Remove's list.

When I try to start the server it fails with "can't find the Path" reported in an Error Event, likewise I can't start the Management Studio because it can't find a file.

I think that I need to clean everything out to reinstall. I think that the Services are left over from the previous owner. Any suggestions?

joe elsaesser

documentation on manual uninstall process for sql 2005: http://support.microsoft.com/?kbid=909967&SD=tech|||

thank you, Derek. It went very well...

j

|||

if you are satisfied would you please mark an answer.

thanks,

Derek

Saturday, February 25, 2012

Problem with using UNION in the where clause.

Hi, I'm using the JDBC:ODBC bridge but am having a problem using it with MS
Access.
I want to run the following thru the bridge;
SELECT * FROM Horse WHERE horseName Like 'MINORS UNION'
I can run this query in Access with no probs. I get an SQL.Exception when
running thru the bridge. I am running thru a try catch block.
I am assuming the problem lies with the keyword UNION being used in the
value.
any help appreciated,
Michael.
I haven't done very much with the JDBC/ODBC bridge. I would think that as
long as the expression 'MINOR UNION' is a valid string delimited by quotes,
the reserved word theory should not be a factor. Can you post the exact
SQLException that you receive?
Carb Simien, MCSE MCDBA MCAD
Microsoft Developer Support - Web Data
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
| From: "Finbar Saunders" <finbar@.netspace.net.au>
| Newsgroups: microsoft.public.sqlserver.jdbcdriver
| Subject: Problem with using UNION in the where clause.
| Date: Fri, 16 Apr 2004 17:46:42 +0930
| Organization: Netspace Internet
| Lines: 16
| Message-ID: <c5o4p6$2i17$1@.otis.netspace.net.au>
| NNTP-Posting-Host: dsl-203-113-238-176.sa.netspace.net.au
| X-Trace: otis.netspace.net.au 1082103398 84007 203.113.238.176 (16 Apr
2004 08:16:38 GMT)
| X-Complaints-To: usenet@.otis.netspace.net.au
| NNTP-Posting-Date: Fri, 16 Apr 2004 08:16:38 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!newsfeed.wirehub.nl!surfnet.nl!newsfeed.kabel foon.nl!195.129.110.21.MIS
MATCH!bnewsfeed00.bru.ops.eu.uu.net!bnewsinpeer01. bru.ops.eu.uu.net!emea.uu.
net!ash.uu.net!duster.adelaide.on.net!news.melbour ne.pipenetworks.com!news.l
abyrinth.net.au!news.netspace.net.au!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.sqlserver.jdbcdriver:5892
| X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
|
| Hi, I'm using the JDBC:ODBC bridge but am having a problem using it with
MS
| Access.
|
| I want to run the following thru the bridge;
| SELECT * FROM Horse WHERE horseName Like 'MINORS UNION'
|
| I can run this query in Access with no probs. I get an SQL.Exception when
| running thru the bridge. I am running thru a try catch block.
|
| I am assuming the problem lies with the keyword UNION being used in the
| value.
|
| any help appreciated,
| Michael.
|
|
|