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 2005 Forums
 Transact-SQL (2005)
 BULK INSERT question

Author  Topic 

kirknew2SQL
Posting Yak Master

194 Posts

Posted - 2007-11-22 : 17:40:59
BULK INSERT question

I am using SQL 2005

I have a text file called Test.txt. It contains one row of data:
ID,"Name","Residency","Gender","Specialty"

I want to import the data into a sql temp table then look at the data. This is the code I tryed:

CREATE TABLE #XTest(ID varchar(50),
PhyName varchar(50),
Residency varchar(50),
Gender varchar(50),
Specialty varchar(50))

BULK INSERT #XTest FROM 'c:\TEST.txt' WITH (FIELDTERMINATOR = ',')
select * FROM #XTest
DROP TABLE #XTest

I don't get any errors. But when I run it:

1. I get a "Save results" dialog. I must enter a name and a .RPT file is created. Why is it doing that at all?
2. The program appears to complete. I get no errors. But I get no Results tab. I don't know if select * FROM #XTest ran at all?

After this i added a known good SELECT as the last line of the program

Select top 10 * from dbo.MyTable

When I execute i still no errors and no Results tab!

Can some one explain what is going on here?!

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-22 : 22:43:28
Sounds you choose to save result to file in query windows, change to save to grid or save to text.
Go to Top of Page

kirknew2SQL
Posting Yak Master

194 Posts

Posted - 2007-11-22 : 22:47:44
That was it. Thank you
Go to Top of Page
   

- Advertisement -