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 |
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2006-12-05 : 09:06:48
|
| Hiusing this command in QueryAnalizer bcp "SELECT TOP 10 * FROM teste.dbo.area" QUERYOUT "area.TXT" -U"sa" -P "teste" -ci get this error Line 1: Incorrect syntax near 'QUERYOUT'.Where is my mistake?tksC.lages |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-12-05 : 10:01:13
|
| BCP is a command-line utility...you can't use it directly in QA.Try using it in combination with xp_cmdshell.Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2006-12-05 : 10:08:04
|
| Ok, i Fix it using in QA in this waySelect * into tmparea from (select * from area) TExec master..xp_cmdShell 'bcp "Select * from teste.dbo.tmparea" queryout "C:\area.txt" -S Clages1 -U"sa" -P "teste" -c -T'Drop table tmparea Works fine nowtksC.lages |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-12-05 : 10:11:32
|
| Good! You are runnng BCP form a command line.But from your code above, why do you copy the content from area table to a temp table, outputting the data from there, and later deleting the temporary table?Why not do this?Exec master..xp_cmdShell 'bcp "Select * from teste.dbo.area" queryout "C:\area.txt" -S Clages1 -U"sa" -P "teste" -c -T'Peter LarssonHelsingborg, Sweden |
 |
|
|
Clages1
Yak Posting Veteran
69 Posts |
Posted - 2006-12-05 : 10:28:21
|
| Because this is a demoi real word in (select * from area)i can use Views and Complex Querys, etcjust itC.Lages |
 |
|
|
|
|
|