Archive for the ‘SQL powershell’ Category

bulk copy data

May 5, 2015

the main goal of this blog is to focus on tools available for doing a bulk copy to a SQL server on windows.

Inserting sequentially –
Sqlcmd – it is a freat tol if you have the data on the machine hosting the SQL server. You can use it if you have the data on a network share but you run into issues with credentials.

BCP- It is a great tool but you need to understand the format files and the syntax of the command. Bcp is like a scripting language where the sepecial characters like “,”, “;” etc. are to be carefully monitored. Also, it is very fical when it comes to validity of source data. For eg: Data time format fields with hours or minutes or seconds not in the HH:MM:SS format will give you a lot of trouble. Missing leading 0’s can be cause of many an issue.

Debugging – Insert a field manually and get it using bcp out.