Home Dashboard Directory Help
Search

Discrepancy in same SQL lookup between Excel and Microsoft SQL Server Management Studio by StevenJT


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 841619
Opened: 3/27/2014 1:07:39 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

In Excel VBA macro coding I ran a query to pull data by joining three tables and placing the data in the columns under Sheet1.
The macro code to extract the data in Excel was:
With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Range("A1"), Sql:=SqlString)
.Refresh
where SqlString was set up as the following query:-
use [database]
SELECT * FROM InvNum inum
LEFT JOIN _btlbInvoiceLines ilin
ON inum.AutoIndex = ilin.iInvoiceID
LEFT JOIN StkItem s
ON ilin.iStockCodeID = s.StockLink WHERE (InvNumber = 'IVQ0835' OR
InvNumber = 'IVQ0834')

I ran the SAME SQL query under Microsoft SQL Server Management Studio and noticed that the Excel query DROPPED THE LAST FIELD OF THE FIRST TABLE (InvNum) before appending the second and third table information in the remaining columns. The last field of the InvNum table should have gone into Excel column ED. Had some limit been exceeded?
All other fields were present in both queries.

This looks like either an SQL, or an Excel, bug.
PLEASE CAN YOU ASSIST IN FIXING THIS AS I AM RELYING ON THIS METHOD TO EXTRACT SQL DATA TO EXCEL?
Details
Sign in to post a comment.
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
ScreenHunter_02 Mar. 26 19.40 (2).jpg (restricted) 3/27/2014 -
Error on Excel SQL Extraction.xlsx (restricted) 3/27/2014 -