SQL UPDATE error

Started by jseaman, March 23, 2015, 02:58:00 PM

Previous topic - Next topic

jseaman

I'm writing an app to manage a set of Applications.  I have a "ton" of SQL queries, but only one in particular seems to be failing with "qExectDirect -1".  I have attributed it to a syntax problem because the SQL Table Column has a space in it.  "Application Status".   Searching and fumbling through SQL syntax does me no good. Does anyone know of a WinBatch to SQL translation I need to apply here?

Passed in to a function:  updateSISDB("SoftwareStore","Availability Status", "Archived", valApplication)

DB UPDATE call:  retcode = qExecDirect(hstmt, "UPDATE %strTable% SET [%strColumn%] = '%strUpdate%' WHERE Application = '%strApplication%'")

I piped the SQL string to a message box and it is appearing correctly.  Again, all other updates to the tables work.

Thanks,

jseaman

Ok, learned something here.  Kind of stupid, but good to know.  My SQL Server has 3 databases on it.  _Prod, _Dev and _Test.  I'm trying to update the [Availability Status] in _Dev.  It is a linked table to a [Status] table with a list of Status' .  Someone updated _Prod with the status of "Archived" but did not go though _Dev or _Test like they should have.

So, basically, I was making an update to a Table that is linked and does not have the Status of "Archived".  I added that to the Status table and amazingly enough, [Availability Status] = 'Archived' now works.

3 lessons here. 

1.  Know your environment
2.  Don't uses spaces in data sets or code, that's why Einstein invented the _.
3.  Follow Good Workflow Distribution Procedures.

Sorry for the wasted time.

:-X

stanl

Glad you figured it out, but as an FYI: it appears you are using the older WB ODBC Extender. I would recommend you looking into ADO or OLEDB rather than the Extender. It is easier to code, fully supported by Microsoft and you will find more examples in the tech db.