Solved

From Jet SQL to SQL server SQL

Posted on 2000-03-17
3
255 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

707 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