I need to combine data from SQL Server tables and a CSV file.
This is the skeleton query
The missing--Credit_Limit sage data has been extracted into a CSV file
Where account_ref matches customer 'Account'. There are other useful fields also.
Can this be done from Query Analyser or am I better in Excel Microsoft Query?
I know how to query an Excel spreadsheet from a stored procedure
But how can I JOIN to a spreadsheet in a query?
This is the skeleton query
Code:
SELECT
customer 'Account',
--Credit_Limit sage
full_name Name,
address,city,phone,
LOWER(dbo.TrimAll(email_address)) 'Email Addr'
FROM cust_acc WITH(NOLOCK)
JOIN cust_data WITH(NOLOCK)
ON cust_acc.customer = cust_data.customer
JOIN accounts WITH(NOLOCK) ON acc_code = acc_id
WHERE acc_code IN ('XXXX')
Code:
account_ref credit_limit
Can this be done from Query Analyser or am I better in Excel Microsoft Query?
I know how to query an Excel spreadsheet from a stored procedure
Code:
OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;
Database=\\nn.n.n.nn\path\to\spreadsheet\speadsheet.xls',
Comment