473,473 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Workaround for SQL Server Views in MySQL?

Hi,

I'm not that up on SQL as a whole as I've concentrated mainly on
frontend and most of the DB backend work I've done has been
with "Access" as that's all the site needed. I have however worked
with SQL Server 2000 a little and now I'm trying to migrate to
MySQL. I understand that views are not supported in MySQL as yet and
was curious to know if there is a workaround this using VBScript?

My VBScript coding is a bit of a mish-mash of Ultradev and hand
coding. I prefer to hand code now but learned mostly from pulling
apart Ultradev code in the beginning. Now, that's the background
sorted so you know what kind of level I'm working at.

I had a SQL Server DB set up with a view like this:

CREATE VIEW dbo.pageQ
AS
SELECT DDCat.ProdID, DDCat.Title, DDCat.Artist, DDCat.Image,
DDCat.Tracks, DDCat.Cass_Price, DDCat.CD_Price,
DDCat.Vid_Price, DDCat.Book_Price, DDCat.Cass_CatNo,
DDCat.CD_CatNo, DDCat.Vid_CatNo, DDCat.Book_CatNo,
DDCat.Comments, DDCat.Weight, DDCat.Category,
Categories.CatName, Categories.CatBlurb,
Categories.CatLabel, Categories.CatHeading,
DDCat.Cass_Price / 0.787564 AS Cass_EPrice,
DDCat.CD_Price / 0.787564 AS CD_EPrice,
DDCat.Vid_Price / 0.787564 AS Vid_EPrice,
DDCat.Book_Price / 0.787564 AS Book_EPrice
FROM Categories INNER JOIN
DDCat ON Categories.CatID = DDCat.Category

I was trying to use that SQL string in a connection to access the
inner join info to no avail - like this:

<%
Dim rsPage__MMColParam
rsPage__MMColParam = "11"
if (Request.QueryString("Category") <> "") then rsPage__MMColParam =
Request.QueryString("Category")
%>

<%
set rsPage = Server.CreateObject("ADODB.Recordset")
rsPage.ActiveConnection = MM_ddcat_STRING
sqlString = "SELECT DDCat.ProdID, DDCat.Title, DDCat.Artist,
DDCat.Image, "
sqlString = sqlString & "DDCat.Tracks, DDCat.Cass_Price,
DDCat.CD_Price, "
sqlString = sqlString & "DDCat.Vid_Price, DDCat.Book_Price,
DDCat.Cass_CatNo, "
sqlString = sqlString & "DDCat.CD_CatNo, DDCat.Vid_CatNo,
DDCat.Book_CatNo, "
sqlString = sqlString & "DDCat.Comments, DDCat.Weight,
DDCat.Category, "
sqlString = sqlString & "Categories.CatName, Categories.CatBlurb, "
sqlString = sqlString & "Categories.CatLabel,
Categories.CatHeading, "
sqlString = sqlString & "DDCat.Cass_Price / 0.787564 AS
Cass_EPrice, "
sqlString = sqlString & "DDCat.CD_Price / 0.787564 AS CD_EPrice, "
sqlString = sqlString & "DDCat.Vid_Price / 0.787564 AS Vid_EPrice, "
sqlString = sqlString & "DDCat.Book_Price / 0.787564 AS Book_EPrice"
sqlString = sqlString & "FROM Categories INNER JOIN "
sqlString = sqlString & "DDCat ON Categories.CatID = DDCat.Category"
rsPage.Source = sqlString & " WHERE DDCat.Category = " + Replace
(rsPage__MMColParam, "'", "''") + ""
rsPage.CursorType = 0
rsPage.CursorLocation = 2
rsPage.LockType = 3
rsPage.Open()
rsPage_numRows = 0
%>

I'm getting a SQL syntax error which is:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[MySQL][ODBC 3.51 Driver][mysqld-4.0.16]You have an error in your
SQL syntax. Check the manual that corresponds to your MySQL server
version for the right syntax to use near 'Categories INNER JOIN
DDCat ON Categories.CatID = DDCat.Categor
/dd/prodii.asp, line 67

Can anyone help me? Is it clear what I'm trying to achieve? Any help
on this would be greatly appreciated as I'm pretty much stuck as to
what to do.

Many thanks in advance,

Lloyd.
Jul 19 '05 #1
0 1330

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: hera | last post by:
I am new at php and MySQL and have some (ugly, I'm sure) code to populate form select fields with data from a MySQL database, so a user can use those to sort/filter and view the 3,000 records. No...
2
by: Becoming Digital | last post by:
I've read through the archives and spent hours on Google but I still can't figure this out. I must extract the data from a SQL Server *.DB file. Viewing the raw text, I can see that there views,...
0
by: Lloyd Dobbler | last post by:
Hi, I'm not that up on SQL as a whole as I've concentrated mainly on frontend and most of the DB backend work I've done has been with "Access" as that's all the site needed. I have however...
2
by: TimMcConechy | last post by:
Hi, I am having a problem with a few "key words" on mysql. LEFT,DATABASE,FIELDS,LOAD,SEPARATOR ,SQL,KEY These are currently column names in our application tables. On other systems (oracle,sql...
9
by: Carter Smith | last post by:
http://www.icarusindie.com/wiki/index.php/Server-Side_Javascript_Check Sample source included This method requires that your pages are PHP enabled and you have mySQL. Although I suppose you...
3
by: raj | last post by:
whats the difference betwwen mysql and sql server2000 in terms of using storedprocedures,stored functions and views.
3
by: nark | last post by:
I just downloaded ODBC drivers from the mySQL web site but whenever I try to create a DSN I get a system 1157 error The driver does show up ok in the windows control panel I cant find any...
1
pbmods
by: pbmods | last post by:
Today I'd like to talk about a new feature introduced in MySQL 5: Views. Views are like snapshots of queries. You can save any query as a view, even complex queries with joins and subqueries,...
0
Coldfire
by: Coldfire | last post by:
Since i cannot show the differences in a two-column like table. I am first putting MS SQL Server 2005 and then MySQL 5.x. MS SQL Server 2005 Brief Overview - SQL Server is a full-fledged...
3
by: Damodhar | last post by:
Whats the simple definition in VIEWS. in mysql
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.