all groups > sql server (alternate) > september 2004 >
You're in the

sql server (alternate)

group:

Problem with SQL generated from MS Access


Problem with SQL generated from MS Access proflicker NO[at]SPAM hotmail.com
9/27/2004 1:46:49 PM
sql server (alternate):
SELECT DISTINCT product.product_id AS Expr1
FROM [SELECT product.product_id, product.item_name, product.display,
product.selling_price, product.smallpicture, product.main_size,
product.main_dinnerware, dbo_coupon_special.coupon_id,
dbo_coupon_special.special_price, coupon.effective_date,
coupon.expiration_date, dbo_ssc_product.mc_id
FROM dbo_ssc_product LEFT JOIN ((product LEFT JOIN dbo_coupon_special
ON product.product_id = dbo_coupon_special.product_id) LEFT JOIN
coupon ON dbo_coupon_special.coupon_id = coupon.coupon_id) ON
dbo_ssc_product.product_id = product.product_id
GROUP BY product.product_id, product.item_name, product.display,
product.selling_price, product.smallpicture, product.main_size,
product.main_dinnerware, dbo_coupon_special.coupon_id,
dbo_coupon_special.special_price, coupon.effective_date,
coupon.expiration_date, dbo_ssc_product.mc_id
HAVING (((product.item_name) Like "*coaster*") AND
((product.display)="y"))]. AS [Alias]

This is the error I get:

The identifier that starts with 'SELECT product.product_id...' is too
long. Maximum lenght is 128

Incorrect syntax near the keyword 'AS'



Any ideas?

Re: Problem with SQL generated from MS Access David Portas
9/28/2004 2:36:11 AM
Replace [...]. with (...)
Replace " with '

SELECT DISTINCT product.product_id AS Expr1
FROM (SELECT product.product_id, product.item_name, product.display,
product.selling_price, product.smallpicture, product.main_size,
product.main_dinnerware, dbo_coupon_special.coupon_id,
dbo_coupon_special.special_price, coupon.effective_date,
coupon.expiration_date, dbo_ssc_product.mc_id
FROM dbo_ssc_product LEFT JOIN ((product LEFT JOIN dbo_coupon_special
ON product.product_id = dbo_coupon_special.product_id) LEFT JOIN
coupon ON dbo_coupon_special.coupon_id = coupon.coupon_id) ON
dbo_ssc_product.product_id = product.product_id
GROUP BY product.product_id, product.item_name, product.display,
product.selling_price, product.smallpicture, product.main_size,
product.main_dinnerware, dbo_coupon_special.coupon_id,
dbo_coupon_special.special_price, coupon.effective_date,
coupon.expiration_date, dbo_ssc_product.mc_id
HAVING (((product.item_name) Like '*coaster*') AND
((product.display)='y'))) AS [Alias]

--
David Portas
SQL Server MVP
--

Re: Problem with SQL generated from MS Access proflicker NO[at]SPAM hotmail.com
9/28/2004 7:28:36 AM
That worked great...

AddThis Social Bookmark Button