Thursday, December 10, 2009

File import in SQLServer 2005

After some tries, and despite of all the ultra-mega-super-lightning-integrated environment provided by Microsoft, I still think that the fastest way to bulk load a csv file into a SQLServer 2005 table is to use plain old Transact-SQL. Assuming you have a csv file with the same structure of an existing table, all you have to to do is write a few lines in your query window and fire an F5:

BULK INSERT your_table
from 'absolute/path/to/your/file'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

Obviously, you could also use different terminators, but all you need to do is to alter the specified parameter.

Wednesday, December 2, 2009

Progress?

You work for a company that produces custom software products. One of your customers experiences a warning message. To give you the best feedback possible, he disciplinately gets a printscreen of the application displaying the message and one of the directory that contains the files produced by the application.

Well educated customer, ain't he? at this point, as you have a helpdesk account, he e-mails the picture with some explaining text...

...too simple, isn't it? that's why he actually printed the images, scanned them, converted them into a pdf and emailed it...

Of course this enabled him to pen down a couple of notes on the images, but... ehm...