2012年3月8日星期四

bcp hanging in SQL2000

I am attempting a very simple bcp out to a text file in SQL 2000 for the first time. I've tried various syntax but the command consistently hangs no matter which i use. Nothing is being directed to the output log.........

"bcp rfsspd..bcp_product_view out product.out -T -c -b500 -r>>test.log"

I have no problems with this command in SQL 6.5, could it be initial setup or config of 2000 or something really daft??

Any help greatly appreciatedMake sure your SQL server can find bcp.exe

C:\Program Files\Microsoft SQL Server\80\Tools\Binn\

Try using this command, see if it makes a difference

DECLARE @.command VARCHAR(255)

SELECT @.command = 'bcp dbName.dbo.tableName in c:\yourFolderName\....\yourTextFile.txt -n -UyourUserName -PyourPassword -fc:\yourFolderName\......\yourFormatFile.fmt -ec:\yourFolderName\.....\yourErrorFile.err'

EXEC spCmdShell @.command

This uses a format file - which you'll have to creat and replace the in with out

没有评论:

发表评论