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
 General SQL Server Forums
 New to SQL Server Administration
 bcp command...help me

Author  Topic 

gmahi
Starting Member

9 Posts

Posted - 2011-07-22 : 19:44:14
Hi,

I have problem, am able to export data to some file using bcp command by giving directly stored procedure name in bcp command, but my problem is i have to pass these stored procedure names from a table where a specifi column is dedicated for stored procedure names, is there any way to use that column from the table in the bcp command.


and one more problem while exporting table data into a excel file using bcp command am not getting the columns, is there any way to fix it.


Thank you

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-22 : 23:59:45
You'll need to use dynamic SQL and then call xp_cmdshell to call bcp.exe.


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

gmahi
Starting Member

9 Posts

Posted - 2011-07-23 : 08:24:05
Thanks Tara,
but am unable to get the results by passing values from table to parameters that are specified in the bcp command , could you give me any example where i can use these table values in bcp command
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-07-23 : 08:30:33
you need to use some kind of loop like cursor or while loop for iterating through values in the table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

speaktokaushal
Starting Member

1 Post

Posted - 2011-08-01 : 06:50:04
how to use bcp command in sql server 2005 plz give me example coz i am confused in parameter
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-01 : 09:46:26
http://msdn.microsoft.com/en-us/library/aa337544(v=sql.90).aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -