[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 612
  • Last Modified:

SQL Update String

Hello,

This portion of my code keeps telling me it is missing a parameter.  Any ideas?

PLU = "MR9H"
  SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo" & x & " = " & PLU
  db.Execute SQL

Open in new window

0
vmccune
Asked:
vmccune
  • 4
  • 4
  • 3
  • +1
1 Solution
 
prachwalCommented:
maybe You don't  Have field Promo in table rtblSKURptHeader
0
 
vmccuneAuthor Commented:
Nope.  The field in the table is promo1,2,3 ect.  the x variable then assigns it to promo1, promo2 etc.  That portion works fine.
0
 
Rey Obrero (Capricorn1)Commented:

PLU = "MR9H"
 SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo" & x & " = '" & PLU & "'"

  db.Execute SQL
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
mbizupCommented:
You're missing a space after Promo.

Corrected:
SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo " & x & " = " & PLU
0
 
mbizupCommented:
In explanation, your resulting SQL would be:


 UPDATE rtblSKURptHeader SET rtblSKURptHeader.PromowhateverTheValueOfXis = ...

The Parameter error is occuring because with X concatenated onto Promo, rtblSKURptHeader.PromowhateverTheValueOfXis  becomes an unrecognized fieldname
 
0
 
Rey Obrero (Capricorn1)Commented:
miriam ,
<You're missing a space after Promo>
if you do that,  the resulting field name will be  Promo 1..

0
 
mbizupCommented:
D'oh...

I should have read more carefully.  Bed time.
0
 
Rey Obrero (Capricorn1)Commented:
the problem lies in the fact that the variable PLU is atext type type of data and being used as a Number type of data in the SQL statement

PLU = "MR9H"
  SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo" & x & " = " & PLU
  db.Execute SQL

this problem was addressed in http:#a24234112  with

PLU = "MR9H"
 SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo" & x & " = '" & PLU & "'"

  db.Execute SQL
0
 
vmccuneAuthor Commented:
Correct String
SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo" & x & " = '" & PLU & "';"

capricorn1 String
SQL = "UPDATE rtblSKURptHeader SET rtblSKURptHeader.Promo" & x & " = '" & PLU & "'"


Problem solved.
0
 
Rey Obrero (Capricorn1)Commented:
vmccune,
you don't even need that { ; } in that statement

0
 
mbizupCommented:
I concur.  

Since the Promo fields are text, the PLU variable needs to be delimited with single quotes.

The only difference between the two statements posted in http:#a24245625 is the trailing semicolon, which is optional.

I recommend accepting http:#a24234112
0
 
vmccuneAuthor Commented:
Thank you for helping me.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 4
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now