Parameterized Queries - Variables, and Access



Hi,

I usually write ADO code to access SQL Server Databases, but at the moment
I am writing code interfacing with Access 2003 instead.

Normally in situations where two or more SQL statements are needed that use
the same filter in the WHERE condition I declare a variable using:

DECLARE @VarName <variabletype> SET @VarName = ?

and then I can use @VarName in both sets of WHERE clauses. This works fine
against SQL Server but fails against Access.

I want to delete from two separate tables within the same Command object.
Is there a special syntax to declare variables in Access specific SQL?

Otherwise in what way do you solve this problem.

My only other solution at the moment is to use two ? placeholders and
declare two identical Parameters in the Parameters collection.


Peter
.



Relevant Pages

  • Re: Parameterized Queries - Variables, and Access
    ... I usually write ADO code to access SQL Server Databases, ... moment I am writing code interfacing with Access 2003 instead. ... Is there a special syntax to declare variables in Access ... This email account is my spam trap so I ...
    (microsoft.public.data.ado)
  • [NT] Microsoft SQL Server 2000 OpenDataSource Buffer Overflow
    ... Microsoft's database server SQL Server 2000 has a remotely exploitable ... Please see the "Fix Information" section for more details. ... attacker in an exploit of the overflow will run uninhibited. ... declare @saved_return_address nvarchar ...
    (Securiteam)
  • Re: Timing out????
    ... I didn't know the column name from tbDateDiff. ... Vyas, MVP ... and means something different to SQL Server. ... > DECLARE @IPResetCount BIGINT ...
    (microsoft.public.sqlserver.programming)
  • Re: Assertion: SQL Server 2000 cant issue a SOAP call
    ... > middle tier) and not in SQL Server. ... > the SOAP endpoint. ... > sp_OA* family of system stored procedures to invoke this COM component. ... > DECLARE @object INT ...
    (microsoft.public.sqlserver.programming)
  • Re: 17805 Starting up Java App server, with SQL Server 2000 Backend
    ... network issue although you would expect a network issue to be more random. ... declare @P1 int ... On another machine running SQL Server 2000 Standard on Win2K advanced, ...
    (microsoft.public.sqlserver.clients)