sql statement that don't run in sql server 2000 | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

sql statement that don’t run in sql server 2000

Hi everyone
I have this vb6 code:
strSql = "select * into [text; FMT=Delimited; HDR=Yes; Database=c: emp].[TC.txt] from Employees"
con.Execute strSql
if my con connects to access database, this bulk of code run ok. If my con connects to Sql server 2000 database, this bulk of code returns error.
Can anyone shows me how to do in Sql server 2000 to get the same result as when running this code with access database ?.
Thanks.

read about bulk copy program(bcp) in BOL to import/export data into text file
What was the error generated?
ALso check the privileges of the account used to run this code. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
http://www.SQL-Server-Performance.Com
This posting is provided �AS IS� with no rights for the sake of knowledge sharing.
Satya, the statement looks like a Jet/ADO thingy. I don’t think it could work in T-SQL at all. Like Ranitjain said, he should use BCP – which unfortunately is not the easiest thing to set up, since it’s a command-line utility.
Adriaan
Thats true, but I feel even with that you can run the code in TSQL and there is a way out if the originator comes with exact problem. As you can see the content of the question seems to be bit vague. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
http://www.SQL-Server-Performance.Com
This posting is provided �AS IS� with no rights for the sake of knowledge sharing.
Try this Exec Master..xp_Cmdshell ‘bcp "Select * from DBName..Employees" queryout "C: empTC.txt" -c’ Madhivanan Failing to plan is Planning to fail
]]>