Search code examples
sqlimportsql-server-2012varbinary

SQL Server 2012 Bulk Import From Excel


I have a very simple question: my client has an Excel worksheet containing 700+ records. One of the column in the worksheet has passwords stored in plain text format.

In my SQL Server 2012 database, I have a table called tbusers with the same no. of columns as the Excel worksheet & in the same sequence.

However I have the password column as varbinary(max) because I store the passwords in encrypted format by creating an asymmetric key with des-512 algo.

When I try to import the Excel using the wizard into the table the password column comes as null despite being converted it shows null.

Kindly help me on this.. how to convert the password field of excel worksheet into varbinary before it's imported into the table using either wizard or T-SQL


Solution

  • Import the excel data to a staging table. Do what you need to do with the data, including encrypting the password. Write to the tbusers table from the staging table.