Re: Bcp and temp tables
From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 09/09/04
- Next message: Aaron [SQL Server MVP]: "Re: VB Date formating Update problem"
- Previous message: David Portas: "RE: Finding Last Day Of the systemdate"
- In reply to: Tibor Karaszi: "Re: Bcp and temp tables"
- Next in thread: Tibor Karaszi: "Re: Bcp and temp tables"
- Reply: Tibor Karaszi: "Re: Bcp and temp tables"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 9 Sep 2004 11:59:24 -0400
I get a different error now.
SQLState = S1010, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Function sequence error
Here is the proc:
USE pubs
GO
CREATE PROCEDURE dbo.Kristoffer
AS
BEGIN
SET NOCOUNT ON
CREATE TABLE ##A
(
id INT
)
INSERT ##A SELECT 1
SELECT * FROM ##A
END
GO
Now from a command line:
bcp "SET FMTONLY OFF EXEC pubs.dbo.Kristoffer" queryout
c:\K.txt -SLOCALHOST -T -c
The file was created, but it is empty, and I get the error mentioned above.
To verify that it was actually finding the proc, I used SET FMTONLY ON and
it yielded the same "Invalid object name '##A'" error. Tried with and
without SET NOCOUNT ON with the same results.
-- http://www.aspfaq.com/ (Reverse address to reply.) "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in message news:OA1#LRolEHA.2968@TK2MSFTNGP14.phx.gbl... > Try: > > bcp "SET FMTOLNY OFF exec MyDatabase.._AAA" queryout aaa.txt -SMyServer -T -c > > Note that your procedure will now be executed three times. Normally, using queryout, only two > executions are performed. Use Profiler to see what happens. > > > -- > Tibor Karaszi, SQL Server MVP > http://www.karaszi.com/sqlserver/default.asp > http://www.solidqualitylearning.com/ > > > "Kristoffer Persson" <hidden> wrote in message news:OBEl%235nlEHA.1656@TK2MSFTNGP09.phx.gbl... > > Can someone please tell me what's wrong? > > > > I get the error "Invalid object name '##AAA" when using BCP like this > > > > bcp "exec MyDatabase.._AAA" queryout aaa.txt -SMyServer -T -c > > > > where _AAA is a stored procedure that looks like this (in MyDatabase) > > > > CREATE PROCEDURE dbo._AAA > > AS > > BEGIN > > if object_id (N'tempdb..##AAA') is not null > > drop table ##AAA > > > > create table ##AAA > > ( > > a int NOT NULL, > > b char(4) NOT NULL, > > ) > > > > insert ##AAA > > select > > a = 1000, > > b = '2000' > > > > select * > > from ##AAA > > END > > GO > > > > I'm lost... > > > > - Kristoffer - > > > > > >
- Next message: Aaron [SQL Server MVP]: "Re: VB Date formating Update problem"
- Previous message: David Portas: "RE: Finding Last Day Of the systemdate"
- In reply to: Tibor Karaszi: "Re: Bcp and temp tables"
- Next in thread: Tibor Karaszi: "Re: Bcp and temp tables"
- Reply: Tibor Karaszi: "Re: Bcp and temp tables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|