Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 BCP.EXE is not working?? Help me

Author  Topic 

ram.marella
Starting Member

15 Posts

Posted - 2009-11-20 : 18:24:55
Hi,

I have the below command in SQL SERVER 2005 SP and when the control is coming to exectue this statement the query executing indefintely.

Select @cmd = 'bcp.exe '+db_name()+'.dbo.'+@table_name+' out '+@data_file+' -S'+@@servername+ ' -T -f'+@fmt_file
Exec master..xp_cmdshell @cmd

it was working fine from years but started giving the trouble from yesterday onwards. all the locations varialbe are giving correct results..but when exec command executed its going indifintlely with out any output.

hel me out.

Thanks
Ram


Thanks
-----------------
Ram MCP

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-20 : 19:30:39
well, what changed yesterday? are you seeing blocking or is it a network issue? what is the result of PRINT @cmd?
Go to Top of Page

ram.marella
Starting Member

15 Posts

Posted - 2009-11-23 : 13:18:42
Hi Russell, Its fetching correct server and rest of the paramters when i do print the @cmd variable..But when i checked the BCP in (loading data from file to table) is working fine withpout any issues. but BCP OUT (putting data from table into file) is getting hang..

Thanks
-----------------
Ram MCP
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-23 : 13:21:06
can you check if some blocking is happening in table using sp_who2 in another window while this is running
Go to Top of Page

ram.marella
Starting Member

15 Posts

Posted - 2009-11-23 : 13:38:15
I dont see any thing is blocking this just thining if BCP utility is having some issues?? but how BCP in is working fine??

Thanks
-----------------
Ram MCP
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-23 : 13:43:26
how many records does your table have? also is data file in use?
Go to Top of Page

ram.marella
Starting Member

15 Posts

Posted - 2009-11-23 : 13:52:45
This table does have only one record which will export date and time...n the file i have deleted and copied new file into the mentioned path (i asume that when i copy new file if any process is lockced/processing will be killed). but still no use..

Thanks
-----------------
Ram MCP
Go to Top of Page
   

- Advertisement -