[sqlite] how do i declare and use variables in sqlite?

2007-08-02 Thread Chase


select 542 as x;

that part works, but then when i try to access it, i get no column x...

select x;

set x = 542;
var x = 542;
@set x = 542;
@var x = 542;
set @x = 542;
var @x = 542;
$set x = 542;
$var x = 542;
set $x = 542;
var $x = 542;


none of these seem to work and i can't find the documentation on this 
subject.


can someone shed some light on this for me?

thanks.

- chase



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] how do i declare and use variables in sqlite?

2007-08-02 Thread James Dennett
 -Original Message-
 From: Chase [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 02, 2007 12:39 PM
 To: sqlite-users@sqlite.org
 Subject: [sqlite] how do i declare and use variables in sqlite?
 
 
 select 542 as x;
 
 that part works, but then when i try to access it, i get no column
x...
 
 select x;
 
 set x = 542;
 var x = 542;
 @set x = 542;
 @var x = 542;
 set @x = 542;
 var @x = 542;
 $set x = 542;
 $var x = 542;
 set $x = 542;
 var $x = 542;
 
 
 none of these seem to work and i can't find the documentation on this
 subject.
 
 can someone shed some light on this for me?

AFAIK, this isn't something you do with SQLite.  You can retrieve values
into variables in the host language (C, C++, or some wrapping language),
and you can bind their values into SQL statements.

-- James


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] how do i declare and use variables in sqlite?

2007-08-02 Thread Paul Harris
On 03/08/07, James Dennett [EMAIL PROTECTED] wrote:
  -Original Message-
  From: Chase [mailto:[EMAIL PROTECTED]
  Sent: Thursday, August 02, 2007 12:39 PM
  To: sqlite-users@sqlite.org
  Subject: [sqlite] how do i declare and use variables in sqlite?
 
 
  select 542 as x;
 
  that part works, but then when i try to access it, i get no column
 x...
 
  select x;
 
  set x = 542;
  var x = 542;
  @set x = 542;
  @var x = 542;
  set @x = 542;
  var @x = 542;
  $set x = 542;
  $var x = 542;
  set $x = 542;
  var $x = 542;
 
 
  none of these seem to work and i can't find the documentation on this
  subject.
 
  can someone shed some light on this for me?

 AFAIK, this isn't something you do with SQLite.  You can retrieve values
 into variables in the host language (C, C++, or some wrapping language),
 and you can bind their values into SQL statements.


in MySQL, you can do something like:

select @xyz := column from table where id=1;

can this be done in Sqlite?  is there an equivalent in standard sql ?

cheers
Paul

-
To unsubscribe, send email to [EMAIL PROTECTED]
-