A few points: I had to remove the last '\' from the path and use [FROM "'+@filepath+'\'+@fileName+'" WITH]. I also had to handle the permission to execute a Cmd instruction with [- this turns on advanced options and is needed to configure xp_cmdshell EXEC sp_configure 'show advanced options', '1' RECONFIGURE -- this enables xp_cmdshell EXEC sp_configure 'xp_cmdshell', '1' RECONFIGURE] And align the various ID and filesName spellings. Otherwise works great. THANK YOU
Thank you Joseph Lusoma. Coming from Oracle database investigating SQL Server equivalents of some funtionality that we have in Oracle database. So question, does the SQL Server Stored procedure T-SQL (sepcifically this BULK INSERT command) handle exceptions in a case there is an error with one of the records? Also it seems your example is for multiple files going into the same single table?
Hello Togara, BULK INSERT will only throw an exception, you would have to add another layer of T-SQL code to handle exception's thrown. i.e you can use TRY.. CATCH. In the Video i use a single database table however it is possible to improve the code and import data into multiple tables basing on i.e filenames or row contents
Hello, Joseph Lusoma!
Thank you very much!
Your video helps me a lot 👍🏻👍🏻
A few points: I had to remove the last '\' from the path and use [FROM "'+@filepath+'\'+@fileName+'" WITH].
I also had to handle the permission to execute a Cmd instruction with
[- this turns on advanced options and is needed to configure xp_cmdshell
EXEC sp_configure 'show advanced options', '1'
RECONFIGURE
-- this enables xp_cmdshell
EXEC sp_configure 'xp_cmdshell', '1'
RECONFIGURE]
And align the various ID and filesName spellings.
Otherwise works great. THANK YOU
One nice topic would be how to make recursive calculations in SQL server
Thank you, It help me alot
Glad it could help.
Feel free to suggest any topic you would like to be uploaded.
Thank you Joseph Lusoma. Coming from Oracle database investigating SQL Server equivalents of some funtionality that we have in Oracle database. So question, does the SQL Server Stored procedure T-SQL (sepcifically this BULK INSERT command) handle exceptions in a case there is an error with one of the records? Also it seems your example is for multiple files going into the same single table?
Hello Togara, BULK INSERT will only throw an exception, you would have to add another layer of T-SQL code to handle exception's thrown. i.e you can use TRY.. CATCH.
In the Video i use a single database table however it is possible to improve the code and import data into multiple tables basing on i.e filenames or row contents