SQL question will be used later in Excel

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
Hello Everyone,

I have a cross table query in Access that I need to run in SQL Server. Here is the code:

Code:
TRANSFORM Sum([track apps].Apps) AS SumOfApps
SELECT [track apps].Branch
FROM [track apps]
GROUP BY [track apps].Branch
PIVOT [track apps].MONTH;

I am running SQL Server 2005.

I get the error message:

Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'trackapps'.
Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near 'PIVOT'.

I would appreciate any help on this.

TIA

Kurt
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
Additional info

Hello again,

I am also trying to get this to work in Excel vba.

I forgot to add that.

Thanks,

Kurt
 

mbb4331

Board Regular
Joined
Dec 22, 2005
Messages
152
How about bringing the data straight from SQL into Excel, then do a pivottable.
 

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
Pivot table

Hello,

Yes I am looking at that possibility also.


Kurt
 

kylefraney

Board Regular
Joined
Mar 21, 2003
Messages
127
I'm unsure as to what the error is but in the past I've cut and pasted SQL statements from Access to Excel via MS Query. Just another option I thought I would throw out there.
 

Kurt

Well-known Member
Joined
Jul 23, 2002
Messages
1,664
MS Query

Hello Kyle,

Thanks for your suggestion.

I am also looking at MS Query you can get a SQL View there as well.

Kurt
 

Forum statistics

Threads
1,141,592
Messages
5,707,287
Members
421,500
Latest member
Alex2302

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top