Solved

From Jet SQL to SQL server SQL

Posted on 2000-03-17
3
250 Views
Last Modified: 2012-08-14
I'm a developer floundering in the world of the DBA. I need to pass a SQL string through ADO that will return records in a CROSS-TAB type fashion. I can do it in access using the following

SELECT dbo_TestSpec.TestID
FROM dbo_ProductSpec INNER JOIN dbo_TestSpec ON dbo_ProductSpec.TestID = dbo_TestSpec.TestID
GROUP BY dbo_TestSpec.TestID, dbo_ProductSpec.SourceID
HAVING (((dbo_ProductSpec.SourceID)='FinalProdt'))
ORDER BY dbo_TestSpec.TestID;

to create an Access query/view QA_Test

then use the following

TRANSFORM Max(dbo_TestResult.Result) AS MaxOfResult
SELECT dbo_TestResult.ProductNo
FROM QA_Tests LEFT JOIN dbo_TestResult ON QA_Tests.TestID = dbo_TestResult.TestID
GROUP BY dbo_TestResult.ProductNo
PIVOT QA_Tests.TestID;


to give the view I want. I can't however do this in SQL server. I can create the QA_Tests view OK but the second query won't run in SQL. Are the TRANSFORM and PIVOT functions valid in SQL server.

I would be grateful of a push in the right direction.


Branch40
0
Comment
Question by:branch40
3 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2627656
I'm DBA for SQL Server 7 and didn't run into such thinks like TRANSFORM or PIVOT, but if somebody finds I'm interested too

The way i work around this generally is to build dynamic SQL statemtents that are executed with EXEC ( ) or sp_ExecuteSQL () when parameters are needed
0
 
LVL 2

Accepted Solution

by:
rdrrichards earned 200 total points
ID: 2627676
You can use your first SQL statement to build a view in SQL Server, that's no problem. If you want to present the data in a pivot or cross tab control that's something you will have to handle on the client side of you app. The TRANSFORM and PIVOT key words or functionality are built into Access and SQL Server doesn't have anything like  it, at least not yet.

My suggestion would be to build the view you need on SQL Server and then use a pivot table or cross tab control on the client to present the data the way you wish. Have the control use the view you created as the data source.

0
 

Author Comment

by:branch40
ID: 2627827
rdrRichards

Thanks, that saves a lot of time looking for something that doesn't exist.

Branch40
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question