473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

BCP call to stored procedure - broke during upgrade from SQL 7.0 to 2000

I have this stored procedure that takes a few parameters like date and
merchant ID, and basically goes through a set of if-then statements to build
a SQL SELECT string.

When we upgraded from SQL Server 7.0 to 2000, the stored procedure still
worked from Query Analyzer, but not in BCP. It used to work in BCP just
fine with 7.0. The error I get now is:

SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]BCP host-files must contain
at least one column

What's really strange is, if I instruct the stored procedure to simply print
the SELECT string, then cut-and-paste it into the end of stored procedure
code (assigning it to the variable that already contains the SELECT string),
then it works from BCP.

Any help would be greatly appreciated.

Aston
Jul 20 '05 #1
1 6433
Aston (al**@selera.com) writes:
I have this stored procedure that takes a few parameters like date and
merchant ID, and basically goes through a set of if-then statements to
build a SQL SELECT string.

When we upgraded from SQL Server 7.0 to 2000, the stored procedure still
worked from Query Analyzer, but not in BCP. It used to work in BCP just
fine with 7.0. The error I get now is:

SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]BCP host-files must contain
at least one column

What's really strange is, if I instruct the stored procedure to simply
print the SELECT string, then cut-and-paste it into the end of stored
procedure code (assigning it to the variable that already contains the
SELECT string), then it works from BCP.


If I understand this right you are doing something like:

bcp "exec some_db..some_sp" queryout datafile.bcp -c -T

To find out what columns there are in the query, bcp first submits the
query with SET FMTONLY ON. This command is causes SQL Server to not execute
the statements in the procedure, but return data about any result sets
it finds. However, if you produces a dynamic SQL string and executes it,
there not be anyting executed with FMTONLY ON, and BCP will not find any
result set.

Why this worked in SQL 7, I don't know. (I never worked much with SQL 7,
jumped direct to SQL 2000 from 6.5.)

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mariusz | last post by:
I want to write function to call another function which name is parameter to first function. Other parameters should be passed to called function. If I call it function('f1',10) it should call...
2
by: mike | last post by:
H There are two ways to execute a stored procedure using ADO.NE - call "exec sp_myproc val1,val2" statement over SqlCommand myCommand = new SqlCommand(SQLQuery, mySqlConnection) - use...
6
by: Sam | last post by:
I had created stored procedure at SQL Server 2000 and how do I call it via ASP.Net using VB Language? CREATE PROCEDURE STK As if exists (select * from dbo.sysobjects where id =...
1
by: RSH | last post by:
Im trying to create a stored procedure of the following code. I want to set it so that I have to send the first 4 variables (@DB, @BackUpFile,@TestDB,@RestoreFile). I am having trouble when i try...
12
by: mednyk | last post by:
T-SQL Debugger Doesn't Allow Stepping Through Stored Procedures And there is no other procedure with the same name owned by dbo or any other users. There is no error messages also, it just...
4
by: Pakna | last post by:
Hi, is there any way to call a JAVA stored procedure from a SQL Trigger? We are having difficulties with this and cannot verify whether DB2 even *has* this capability? Thank you very much....
3
by: Goog79 | last post by:
Hi everyone, first time here, so I'm sorry if this has been covered already ages ago. :( I am trying to learn T-SQL and Stored Procedures and bought the book on these topics by Djan...
5
by: Pedro Vera | last post by:
I am helping somebody setup one of the asp.net starter kits. I converted it from sql express to sql server with no real issues, and I got it running local perfectly. On my first attempt to run...
2
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.