I find this method way easier than messing with SQL Server Import/Export Wizard. Although it can be useful to have the wizard create the target table definition first.
CREATE TABLE [dbo].[TargetTable] (
[Id] [int] NULL,
[StringCol] [varchar](MAX) NULL,
[IntCol] [int] NULL
-- additional columns here
) ON [PRIMARY]
GO
BULK INSERT [dbo].[TargetTable]
FROM 'C:\pathto\SourceFile.csv'
WITH
(
FIRSTROW = 2, -- 2 if there are headers
FIELDTERMINATOR = ',', -- field delimiter
ROWTERMINATOR = '\n', -- next row
ERRORFILE = 'C:\pathto\_ImportErrors.txt',
TABLOCK
)
GO
Tuesday, July 22, 2014
Monday, July 21, 2014
Background download of wikipedia dump on Linux
A handy way to download a wikipedia dump in the background in such a way that it continues after ending a terminal session:
$ nohup wget -bqc http://dumps.wikimedia.org/enwiki/20140707/enwiki-20140707-pages-articles-multistream.xml.bz2
Latest wiki dump url can be found here:
http://dumps.wikimedia.org/backup-index.html
References:
http://www.cyberciti.biz/tips/nohup-execute-commands-after-you-exit-from-a-shell-prompt.html
http://www.cyberciti.biz/tips/linux-wget-your-ultimate-command-line-downloader.html
$ nohup wget -bqc http://dumps.wikimedia.org/enwiki/20140707/enwiki-20140707-pages-articles-multistream.xml.bz2
Latest wiki dump url can be found here:
http://dumps.wikimedia.org/backup-index.html
References:
http://www.cyberciti.biz/tips/nohup-execute-commands-after-you-exit-from-a-shell-prompt.html
http://www.cyberciti.biz/tips/linux-wget-your-ultimate-command-line-downloader.html
Tuesday, July 15, 2014
Setting up an FTP server on CentOS 6.x
Need FTP access on a CentOS machine? Easy.
sudo yum install vsftpd
sudo service vsftpd start
sudo chkconfig vsftpd on
chkconfig --list
sudo vi /etc/vsftpd/vsftpd.conf # edit default conf file to have these lines:
anonymous_enable=NO
chroot_local_user=YES
chroot_list_enable=NO
chroot_list_file=/etc/vsftpd/chroot_list
pasv_min_port=3000
pasv_max_port=3050
sudo touch /etc/vsftpd/chroot_list
sudo /sbin/service vsftpd restart
Done.
Note that these steps have been grabbed from this Rackspace article that includes much more detail:
http://www.rackspace.com/knowledge_center/article/rackspace-cloud-essentials-centos-installing-vsftpd
sudo yum install vsftpd
sudo service vsftpd start
sudo chkconfig vsftpd on
chkconfig --list
sudo vi /etc/vsftpd/vsftpd.conf # edit default conf file to have these lines:
anonymous_enable=NO
chroot_local_user=YES
chroot_list_enable=NO
chroot_list_file=/etc/vsftpd/chroot_list
pasv_min_port=3000
pasv_max_port=3050
sudo touch /etc/vsftpd/chroot_list
sudo /sbin/service vsftpd restart
Done.
Note that these steps have been grabbed from this Rackspace article that includes much more detail:
http://www.rackspace.com/knowledge_center/article/rackspace-cloud-essentials-centos-installing-vsftpd
Subscribe to:
Comments (Atom)