Solved

From Jet SQL to SQL server SQL

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now