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.
| Author |
Topic |
|
abc123
Starting Member
47 Posts |
Posted - 2009-02-11 : 06:14:32
|
| Hi, Please tell me the steps for BCP in and out |
|
|
abc123
Starting Member
47 Posts |
Posted - 2009-02-11 : 06:15:21
|
| I have SQL server 2005 installed |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-11 : 06:58:47
|
| have a look at books online. This is a nice article as well.http://www.sqlteam.com/article/exporting-data-programatically-with-bcp-and-xp_cmdshell |
 |
|
|
abc123
Starting Member
47 Posts |
Posted - 2009-02-11 : 07:22:25
|
| i have tried but getting following errorC:\Documents and Settings\187593>bcp 'SELECT * FROM SBx..CreditScore' queryout CreditScore.txt -U lm -P lm -c'bcp' is not recognized as an internal or external command,operable program or batch file. |
 |
|
|
Rajesh Jonnalagadda
Starting Member
45 Posts |
Posted - 2009-02-11 : 07:31:29
|
| Try this,DECLARE @FileName NVARCHAR(100) ,@bcpCommand NVARCHAR(1000) ,@FilePath NVARCHAR(100)SET @bcpCommand = 'bcp "SELECT * FROM DatabaseName.dbo.TableName" queryout "'SET @bcpCommand = @bcpCommand + @FilePath+ @FileName + '" -c -T -t","'EXEC master..xp_cmdshell @bcpCommandRajesh Jonnalagadda[url="http://www.ggktech.com"]GGK TECH[/url] |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-11 : 07:38:03
|
quote: Originally posted by abc123 i have tried but getting following errorC:\Documents and Settings\187593>bcp 'SELECT * FROM SBx..CreditScore' queryout CreditScore.txt -U lm -P lm -c'bcp' is not recognized as an internal or external command,operable program or batch file.
Are you running from command prompt ? You sure you have MS client installed on the machine ? The links I gave you describe how to run it from the analyzer. |
 |
|
|
abc123
Starting Member
47 Posts |
Posted - 2009-02-11 : 07:41:28
|
| i have tried as C:\Program Files\Microsoft SQL Server\90\Tools\Binn>bcp 'SELECT * FROM SBx..CreditScore' queryout CreditScore.txt -U lm -P lm -c'bcp' is not recognized as an internal or external command,operable program or batch file.C:\Program Files\Microsoft SQL Server\90\Tools\Binn> |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-11 : 07:49:28
|
| do you have bcp.exe @ C:\Program Files\Microsoft SQL Server\90\Tools\Binn ??? check in the machine from where you are running it. |
 |
|
|
|
|
|