Upload Text File to SQL Server Database Table
Recently I did upload a password list stored in text file to SQL Server database table.
I used SQL Server Bulk Insert command to insert text data into sql table as rows.
Since the data structure in the text file was simple, just containing a password string on each line, the SQL Bulk Insert command was also simple.
In this SQL tutorial, you can find how to upload simple text file data into SQL Server database table using Bulk Insert statement.
I download top 10000 most common passwords list and upload this most frequently used passwords list to my SQL Server development database to use for password generator tool and password strength check tool that I'm developing in SQL.
Following SQL code is part of the SQL script that I use to upload password list text file data into SQL Server database table.
I use SQL Server BULK INSERT command to import text file data to SQL table.
First I create a SQL database table CommonPasswordsList which will be populated with data imported from text file.
Then I execute BULK Insert command with target sql table and path of the source text file.
create table CommonPasswordsList ([password] nvarchar(max))
BULK INSERT CommonPasswordsList FROM 'c:\passwordlist.txt'
Above code is successfully executed to insert 10 thousand passwords read from text file into SQL Server database table.