?
Solved

From Jet SQL to SQL server SQL

Posted on 2000-03-17
3
Medium Priority
?
270 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 600 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

752 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