HELP with syntax

HELP with syntax

Post by D. Anderso » Fri, 16 Nov 2001 12:46:13



I am trying to place 3 values into a sql statement.  I receive the
following error.  How do I place this value using my form?

<p>Microsoft OLE DB Provider for ODBC Drivers</font> <font face="Arial"
size=2>error '80040e07'</font>
<p>
<font face="Arial" size=2>[Microsoft][ODBC SQL Server Driver][SQL
Server]Syntax error converting the varchar value '19,30,31' to a column
of data type int.</font>
<p>

My SQL which is running on 7.0 looks like this.  I am inserting the data
from a form into the <% status %>

        thesql = "SELECT DISTINCT Website.url, Website.pagetitle,
sciLINKS.scilink, Codes.code,  Website.nasa_owner, Website.nasa_content,
WebsiteLevel.levelid "
       thesql = thesql & "FROM (((TextbookLinks "
       thesql = thesql & "INNER JOIN ((Website INNER JOIN WebsiteLevel
ON Website.siteID = WebsiteLevel.siteid) "
       thesql = thesql & "INNER JOIN SiteCoordinate ON Website.siteID =
SiteCoordinate.siteid) ON TextbookLinks.coordinateid =
SiteCoordinate.coordinateid) "
       thesql = thesql & "INNER JOIN sciLINKS ON
TextbookLinks.txtbklinkid = sciLINKS.txtbklinkid) INNER JOIN Textbook ON
TextbookLinks.textbookid = Textbook.textbookid) "
       thesql = thesql & "INNER JOIN Codes ON Website.nasa_owner =
Codes.codeid "
       thesql = thesql & "WHERE Website.status = '" & status & "'"
       thesql = thesql & "and " & nasa & "= '" & code & "'"
       thesql = thesql & "and WebsiteLevel.levelid = '" & levelid & "'"

--
David Anderson
Project sciLINKS
http://www.scilinks.org
1840 Wilson Blvd
Arlington, VA 22201
(703) 312-9297
(703) 526-9754 FAX

 
 
 

HELP with syntax

Post by Greg Obleshchu » Fri, 16 Nov 2001 13:17:57


D. Anderson

Try this

        thesql = "SELECT DISTINCT Website.url, Website.pagetitle, sciLINKS.scilink, Codes.code,  Website.nasa_owner, Website.nasa_content, WebsiteLevel.levelid "
       thesql = thesql & "FROM (((TextbookLinks "
       thesql = thesql & "INNER JOIN ((Website INNER JOIN WebsiteLevel ON Website.siteID = WebsiteLevel.siteid) "
       thesql = thesql & "INNER JOIN SiteCoordinate ON Website.siteID = SiteCoordinate.siteid) ON TextbookLinks.coordinateid = SiteCoordinate.coordinateid) "
       thesql = thesql & "INNER JOIN sciLINKS ON TextbookLinks.txtbklinkid = sciLINKS.txtbklinkid) INNER JOIN Textbook ON TextbookLinks.textbookid = Textbook.textbookid) "
       thesql = thesql & "INNER JOIN Codes ON Website.nasa_owner = Codes.codeid "
       thesql = thesql & "WHERE Website.status in (" & status & ")"
       thesql = thesql & "and " & nasa & "= '" & code & "'"
       thesql = thesql & "and WebsiteLevel.levelid = '" & levelid & "'"

regards

Greg O


  I am trying to place 3 values into a sql statement.  I receive the following error.  How do I place this value using my form?
  <p>Microsoft OLE DB Provider for ODBC Drivers</font> <font face="Arial" size=2>error '80040e07'</font>
  <p>
  <font face="Arial" size=2>[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value '19,30,31' to a column of data type int.</font>
  <p>

  My SQL which is running on 7.0 looks like this.  I am inserting the data from a form into the <% status %>

          thesql = "SELECT DISTINCT Website.url, Website.pagetitle, sciLINKS.scilink, Codes.code,  Website.nasa_owner, Website.nasa_content, WebsiteLevel.levelid "
         thesql = thesql & "FROM (((TextbookLinks "
         thesql = thesql & "INNER JOIN ((Website INNER JOIN WebsiteLevel ON Website.siteID = WebsiteLevel.siteid) "
         thesql = thesql & "INNER JOIN SiteCoordinate ON Website.siteID = SiteCoordinate.siteid) ON TextbookLinks.coordinateid = SiteCoordinate.coordinateid) "
         thesql = thesql & "INNER JOIN sciLINKS ON TextbookLinks.txtbklinkid = sciLINKS.txtbklinkid) INNER JOIN Textbook ON TextbookLinks.textbookid = Textbook.textbookid) "
         thesql = thesql & "INNER JOIN Codes ON Website.nasa_owner = Codes.codeid "
         thesql = thesql & "WHERE Website.status = '" & status & "'"
         thesql = thesql & "and " & nasa & "= '" & code & "'"
         thesql = thesql & "and WebsiteLevel.levelid = '" & levelid & "'"

  --
  David Anderson
  Project sciLINKS
  http://www.scilinks.org
  1840 Wilson Blvd
  Arlington, VA 22201
  (703) 312-9297
  (703) 526-9754 FAX

 
 
 

1. SQL Syntax Help - Incorrect syntax near '%'.

Ok, using MS SQL Server 7.0, I am doing a simple query using JTurbo
jdbc driver.
I am accessing this through JBoss/Tomcat.

This is my sql:

select person.personid, person.lastname, i.storeid, i.id
from person
left outer join
  (select table2.personid,table2.eventdate,table3.*
  from table2
  join table3 on table2.id=table3.id ) i
on i.personid=person.personid
where (person.lastname like '%lastname%')
Order by lastname, person.personid desc

Whenever I run it, I get "Incorrect syntax near '%'."
However, if I copy/paste this to MS Query Analyzer, it works PERFECT.
I also have other queries which are similar, and they work fine.
Also, if I take the where( ... ) part out, it works fine (but I do not
get any where control, which is needed).

Any help would be appreciated.
Thanks,
  -- Chris

2. VFP 6.0 VIEW BUILDER BUGS ??

3. HELP / HELP / syntax SQL / 'LIKE' clause

4. Stored Procedures

5. Help with syntax. Concatenating strings

6. We Companion problem

7. Help - SQL syntax

8. US-MO-ORACLE 8I REPORTER / DEVELOPER

9. need help with syntax for CONTAINS statement

10. Help with syntax.

11. help with syntax please.

12. Help with Syntax - Rev2

13. Help on syntax