SQL - amateur question: What syntax do I use? 
Author Message
 SQL - amateur question: What syntax do I use?

I am new to SQL and Jet. I have a book that describes an SQL statement
as follows:

PARAMETERS EmployeeIDSelect Long, SalaryIncreaseFactor Single;
SELECT
    Employee.LastName,
    Employee.FirstName,
    Employee.Salary,
    CCur(Employees.Salary*SalaryIncreaseFactor) AS NewSalary
FROM Employees
WHERE Employees.EmployeeID = EmployeeIDSelect;

How do I assign this to a variable? Would it be like this:

S = "PARAMETERS EmployeeIDSelect Long, SalaryIncreaseFactor
Single;SELECT Employee.LastName, Employee.FirstName,  Employee.Salary,
CCur(Employees.Salary*SalaryIncreaseFactor) AS NewSalary FROM Employees
WHERE Employees.EmployeeID = EmployeeIDSelect;"

or like this

S = "PARAMETERS EmployeeIDSelect Long, SalaryIncreaseFactor Single; _
        SELECT _
            Employee.LastName, _
            Employee.FirstName, _
            Employee.Salary, _
            CCur(Employees.Salary*SalaryIncreaseFactor) AS NewSalary _
        FROM Employees _
        WHERE Employees.EmployeeID = EmployeeIDSelect;"

or none of the above?
G.Doucet



Thu, 05 Sep 2002 03:00:00 GMT  
 SQL - amateur question: What syntax do I use?

Quote:
>Subject: SQL - amateur question: What syntax do I use?

>Date: 3/19/00 9:15 AM Central Standard Time

>I am new to SQL and Jet. I have a book that describes an SQL statement
>as follows:

>PARAMETERS EmployeeIDSelect Long, SalaryIncreaseFactor Single;
>SELECT
>    Employee.LastName,
>    Employee.FirstName,
>    Employee.Salary,
>    CCur(Employees.Salary*SalaryIncreaseFactor) AS NewSalary
>FROM Employees
>WHERE Employees.EmployeeID = EmployeeIDSelect;

>How do I assign this to a variable? Would it be like this:

>S = "PARAMETERS EmployeeIDSelect Long, SalaryIncreaseFactor
>Single;SELECT Employee.LastName, Employee.FirstName,  Employee.Salary,
>CCur(Employees.Salary*SalaryIncreaseFactor) AS NewSalary FROM Employees
>WHERE Employees.EmployeeID = EmployeeIDSelect;"

>or like this

>S = "PARAMETERS EmployeeIDSelect Long, SalaryIncreaseFactor Single; _
>        SELECT _
>            Employee.LastName, _
>            Employee.FirstName, _
>            Employee.Salary, _
>            CCur(Employees.Salary*SalaryIncreaseFactor) AS NewSalary _
>        FROM Employees _
>        WHERE Employees.EmployeeID = EmployeeIDSelect;"

>or none of the above?
>G.Doucet

You can't have an opening quote be one line and have its end be on the next.
Also, attend to spaces at the start/end of lines. Try the following:

SQL = "PARAMETERS ......;" _
& " SELECT ......" _
& " FROM ..... WHERE ....;"

HTH,
Merjet



Thu, 05 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Amateur programmer seeking amateur programmer

2. VB6: Oracle 8/SQL Server 2000 compatibility problems using ADO 2.5 and SQL Syntax

3. VB6: Oracle 8/SQL Server 2000 compatibility problems using ADO 2.5 and SQL Syntax

4. amateur has question

5. amateur question on Jet Database and FlexGrid.

6. SQL in VBA syntax question

7. DELETE sql syntax question

8. SQL query syntax question

9. SQL syntax question - query??

10. Easy SQL Syntax Question

11. Multitable joins/Using ODBC SQL Syntax

12. Error 3131 Syntax error in FROM clause - using SQL accessing external ODBC problem

 

 
Powered by phpBB® Forum Software