MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Variable passing to SQLExecute

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93629] Re: Variable passing to SQLExecute
  • From: Dean Williams <deanwilliams at mac.com>
  • Date: Tue, 18 Nov 2008 07:23:16 -0500 (EST)
  • References: <gf6dpq$k0b$1@smc.vnet.net>

On Nov 9, 5:24 am, joh... at dsl.net wrote:
> I'm trying to pass a variable to a SQLExecute command as follows:
>
> v1=55
> v2 =1500
> SQLExecute[db, "UPDATE table1 SET result = v1 WHERE recnum = v2"]
>
> If I substitute v1 for a number it works.
>
> Thanks

Try this:

v1 = 55;
v2 = 1500;

sqlString1 = "UPDATE table1 SET result = ";
sqlString2 = " WHERE recnum = ";
sqlComb =
  StringJoin[sqlString1, ToString[v1], sqlString2, ToString[v2]];

SQLExecute[db, sqlComb]

Dean


  • Prev by Date: Re: List of Month Names
  • Next by Date: Re: List of Month Names
  • Previous by thread: Variable passing to SQLExecute
  • Next by thread: Finding Roots of Polynomials over Polynomial Quotient Rings