I've got an Excel spreadsheet with a lot of data I want to get into a table in an SQL 2012 server. It is working very well with the exception of one particular field. In the code below, everything inserts properly with the exception of @SolutionID. If I supply a default value for @SolutionID, the code executes and all 1200 or so records get inserted. If I don't supply a default value for @SolutionID, I get a dialog box that says
Procedure or function 'usp_InsertLogSolutions' expects parameter '@SolutionID', which was not supplied.
. I've tried eliminating some of the other fields in case cmd.Parameters was getting too long. Here is the VBA...
There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
At the moment, it appears that there's something magical about the name @SolutionID or its position in the order of the fields. When I changed the name to @Test throughout the table, SP and VBA and inserted it first, it worked.
Hmmmm. I had made some other changes before I got your suggestion. I have changed the field name to Test throughout and it is now working. I did add the = 9999, in the SP, but it is inserting the correct value now that the field is named Test.
Hmmmm. I hadn't mentioned that the date thing wasn't working before, but now it's working too, i.e. inserting the current date and time if one isn't supplied.
Well, the solution I accepted, isn't really the solution, but it put me on the right track to fixing the problem. Somehow all of the changing I did to the SP, the table, and the VBA, corrected the problem, so I suspect it was some kind of syntax error. I also renamed the [/i]Date[/i] column to [/i]DateIns[/i] and made it the last column. Now everything is working properly.
There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
Windows Explorer lets you open cabinet (cab) files like any other folder.
In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.