Solved

From Jet SQL to SQL server SQL

Posted on 2000-03-17
3
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

735 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