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
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Basic basically BCP

Author  Topic 

LeoC
Starting Member

37 Posts

Posted - 2004-12-28 : 14:46:38
This may be a trivial "?", but I believe a while back we could pass queryfiles to BCP which contained DDL statements, such as create/drop tables.
I don't seem to find the flag for it; tried 'queryout' but something is wrong with my syntax:

bcp DbName queryout -is:\bcp\FileName.sql -T -SServerName

Any input/help would be gladly appreciated!

Cheers,

lec.

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-28 : 14:56:26
You are probably looking for osql which will execute script files.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

LeoC
Starting Member

37 Posts

Posted - 2004-12-28 : 16:17:33
'guess you're right...although back then it was still called isql. Which ever works!

Thanks

lec.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-28 : 16:27:07
Yep isql was replaced by osql.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

LeoC
Starting Member

37 Posts

Posted - 2004-12-29 : 18:55:28
OK, NR hoping you or someone else have got to deal with this before; it may sound simplistic, but could get "tiredsome" pretty quick...
Once I finish with the BCP and [hopefully] loads allright then my BCP command tells it create an error file, it there are errors the file is not "0 bytes" otherwise it is.
This is my [so far] only triggering point to catch success or failure.

So far I have the 'read DIR' method whose output could be inserted into a temp/table and then 'parse' for that 0 bytes 'near' the name.
As I said, this parsing could become out-of-control if all versions os OS and SQL are considered.
Thus, I thought may someone has already ran into somewhat similar situation?

Out of exec master..xp_cmdshell "dir ...\FileName.txt"

output
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Volume in drive \\hhsqltest02\d$ is Logs
Volume Serial Number is FC99-54C2
NULL
Directory of \\hhsqltest02\d$\bcp\leo
NULL
12/29/2004 03:23p 0 mra1_1228.err
1 File(s) 0 bytes
0 Dir(s) 7552614400 bytes free
NULL


lec.
Go to Top of Page
   

- Advertisement -