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 |
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-05-15 : 11:21:43
|
This worksExec Master..xp_Cmdshell 'bcp Rating.Policy.StatCoding out \\xx\yy\zz\Actuary\Stat.txt -S myServer -c'but this gives me an errorExec Master..xp_Cmdshell 'bcp "Select StatCoding From Rating.Policy.StatCoding" queryout \\xx\yy\zz\Actuary\Stat.txt" -S myServer -c'ofPassword: SQLState = S0002, NativeError = 208Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'Rating.Policy.StatCoding'.SQLState = 37000, NativeError = 8180Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.NULLWhat I am missing?Thanks,JimEveryday I learn something that somebody else already knew |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2012-05-15 : 13:55:47
|
is there such a databaseRatinga schema.Policyand a table.StatCoding<><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion |
 |
|
vijays3
Constraint Violating Yak Guru
354 Posts |
Posted - 2012-05-15 : 14:20:03
|
Try this on your command promt ..If it Runs you can changeit accordinglybcp "Select StatCoding From Rating.Policy.StatCoding" queryout YourLocalFileLocation -c -S myServer -T YourLocalFileLocation :--- Make file at your local machine like D:\Data\yourefile.txtmyServer : Specify DatabaseserverName hereVijay is here to learn something from you guys. |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-05-15 : 15:25:48
|
That works from the command prompt, but not inside my stored procedure! Thanks, for your help. What's the next step?JimEveryday I learn something that somebody else already knew |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-05-15 : 15:32:14
|
quote: Originally posted by jimf Exec Master..xp_Cmdshell 'bcp "Select StatCoding From Rating.Policy.StatCoding" queryout \\xx\yy\zz\Actuary\Stat.txt" -S myServer -c'
What's up with the extra double quote character after Stat.txt ? N 56°04'39.26"E 12°55'05.63" |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-05-15 : 15:38:09
|
A small piece of cheese for Peso! I took out the extra " after txt, but now it gave and unknown argument error.It doesn't lile the name of my "myServer" which is actually servername\SQL2008.JimEveryday I learn something that somebody else already knew |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-05-15 : 15:54:17
|
put your server name in brackets []. It that doesn't work, try double qoute for the server instance name. N 56°04'39.26"E 12°55'05.63" |
 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-05-15 : 16:54:22
|
A full wedge of cheese for Peso! The brackets didn't work but the double quotes did! Thank you so much, I was about to lose my mind!JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|