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 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-12-25 : 17:24:54
|
| I use this in a new query script in SSMS:use dbtest1bcp mycsvtable1 in 'C:\myDev\SQL\CSVproject\myCSV.txt' -T -cbut i get the error:Msg 102, Level 15, State 1, Line 2Incorrect syntax near 'bcp'.I also tried:myDatabase.dbo.mycsvtable1 and I got the same errorany help pls? |
|
|
madhuotp
Yak Posting Veteran
78 Posts |
Posted - 2006-12-26 : 01:44:54
|
| u must run BCP from Command Prompt or using XP_cmdshellMadhu |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-12-26 : 11:31:30
|
| If you are importing data, you can also use the BULK INSERT command. The options are very similar to BCP. You can find the exact syntax in SQL Server Books Online.CODO ERGO SUM |
 |
|
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-12-26 : 12:52:28
|
| in cmd shell. i guess i should use:bcp myDatabase.Owner.myTable .....1/how do i know who the owner of the table is? i mean if it s dbo or other?any command or something like that?2/ and will i have to include the sql instance name as well in the command?Thanks a lot. |
 |
|
|
madhuotp
Yak Posting Veteran
78 Posts |
Posted - 2006-12-26 : 23:30:27
|
You have to mention Database.Schema.ObjectName in BCP. If these are to be dynamic, then you have to use XP_CmdShell and Dynamic SQLquote: Originally posted by rtutus 2/ and will i have to include the sql instance name as well in the command?
To connect to a particular Instance u have to mention -S option in BCP command.Madhu |
 |
|
|
|
|
|