sql

  1. baitmaster

    help writing SQL query including Join and Subquery

    I’m working with SQL in Excel, and it’s working well. Now I want to add a new query that’s slightly more complex than the others and is outside my limited SQL comfort range. I have 3 tables (worksheets): Table1 contains JourneyRef, RouteNum, DepTime, ArrTime Table 2 contains RouteNum, Origin &...
  2. S

    MS Access Top N Values Show in Table

    Hi, I have a table in Access which contains sales total. I need only Top 2 Values in each column. My input data is below: <colgroup><col span="8"></colgroup><tbody> Prd_Code Prd_Desc Cat_Code Cat_Desc Q1_Sales Q2_Sales Q3_Sales Q4_Sales 111 ABC 11 A 12 12 87 34 222 DEF 22 B 43 56 56 56...
  3. S

    VBA Excel SQL Error "No Value Given for One or More Required Parameters"

    Hello Code adopted from below URL https://analystcave.com/excel-using-sql-in-vba-on-excel-data/ Getting syntax error as per the above heading when following query executed SELECT [Sheet1$].[First Last], [Age], [Salary] FROM [Sheet1$] INNER JOIN [Sheet2$] ON [Sheet1$].[First...
  4. B

    SQL statement is give me error 3061 Too few parameters. Expected 1

    The SQL statement works in the query grid but not in the vba. I want a search box to pop up and I will enter the EquipID into the search box then it will load the correct records into a list box for that EquipID. See below for the SQL Statement. strSQL = "SELECT tblTag.TagNumber, tblTag.TagID...
  5. R

    Using SQL in VBA LEFT JOIN to fetch data from multiple sheet

    Hi Expert, I have three sheets of data using LEFT JOIN i am supposed to pull the required columns as result. This is the main motive. With the help of this link https://analystcave.com/excel-using-...on-excel-data/ i took the code which does connection to my excel sheets. I need an experts...
  6. M

    Comment column with updated or inserted

    Hi All, I have a excel sheet with the connectivity with the sql server. I use this sheet to insert,Update, delete data from the sql server. Now I'm trying to add a column in this which says if the row was inserted or updated in the database. Can anybody please guide me ho to do this? Thankyou
  7. B

    MS SQL connection that will work in Windows and Mac version of Excel Office 365.

    I have a spreadsheet that retrieves data from a SQL server. I can get it to work in Windows but when I try it on the Mac it fails and when I get it working on the Mac it fails in Windows. Is there a way to create a connection that will work in either version? Windows has to be trusted...
  8. D

    data connection from several databases same model same SQL

    hi I want to get data from SQL, the problem is that in this SQL there are several databases each for different company the tables and model in each database in the same SQL host is exactly the same I do not need one data base but several all together finally I wish to create dashboard and...
  9. J

    Using Vlookup/If to extract values from one named cell in a big data spread sheet

    Hi, I am wondering how I can easily extract wanted data from a spread sheet that is connected to a SQL-database sorting values in random order. Lets say the data is sorted like his: (as you can see, they are not sorted with same intervals all the time) 1 A E 2 Savings...
  10. A

    Create SQL table from Excel VBA

    Hello - I have the following table in Excel <tbody> SLCo SL CompCode APRef Amount Release 101 19 CM 967 5000 101 19001-01P CM 19001-0719 10500 X 101 123546-A CM 123658-1 15000 X 101 56875-4 CM 9856-7A 7500 X 101 32587-4 CM 5647-8 21500 </tbody> Using VBA on a button, I'd like...
  11. N

    Automate Export Data from Excel to SQL

    I am trying to export (and automate) a VBA excel file to SQL . So I tried to configure an Excel data source as a linked server But I got the following issue: Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc) ADDITIONAL INFORMATION: An exception occurred...
  12. M

    Syntax error in UPDATE statement using ADO

    I've looked everywhere for a solution to this issue with no luck. I'm using ADO to connect a workbook to a second workbook and then update certain fields in the second workbook. I can get this to work perfectly on any data type except a date. The second workbook has a column called Timestamp...
  13. J

    Query linked SQL Server from Excel VBA?

    We have a set of Excel files that query a SQL Server database. They were all created from a template and all use the same connection string. Now that server is being decommissioned and the new server will follow a different naming convention, so the server name will change. The problem is that...
  14. M

    SQL to multiply value from previous record ? How ?

    Pls help... I have a table like this ID , Rate ========== 1, 0.2 2, 0.5 3, 0.3 I want the query ID , Rate, result ========== 1, 0.2, 0.2 2, 0.5 , 0.1 3, 0.3, 0.03 What is the SQL to achieve this ? Any idea and interim table needed ? ie, accumulate multiplication (instead of sum) is...
  15. K

    ADODB Connection referring to Local path NOT Network

    Hello, I've been trying to fix this all day with no luck. The goal of this code is to use a function to look up a value in a table in an Access database (.accdb) and return a different value. I am running the code below, and the adoCN works just fine. It creates a locked .accdb file showing...
  16. M

    INSERT INTO SELECT * FROM tblName IN 'Db Location'

    Hi, I'm trying to consolidate data from multiple access databases into SQL Server. The code works fine but the only drawback is when there is a new column in a source access database table 'Db Location' it results into an error. Is there a way in SQL where I can specify to SKIP unmatched fields?
  17. G

    VBA - SQL Database - ActiveSheet.Name

    Hi, Straight to the point but here is the code stADO = "Provider=SQLOLEDB;Data Source=UKD1-ENG-01;Initial Catalog=" & ActiveSheet.Name & "WWALMDB;User ID=SA;Password=*****" Basically this works, however instead of it pulling from: (sheet name)WWALMDB i would like it to pull from...
  18. D

    Excel parameterized SQL query with IN clause

    Hi! I'm running Office365 package Excel 2016 with MS Query to DB2 SQL database with the query being parameterized towards a specific Excel cell value (although I need to populate this cell from a larger range first). While SQL clauses work fine when cell has a single value, I need to run SQL IN...
  19. P

    SQL Query on PowerPivot Data Model through VBA?

    Hi all - I'm in the process of developing an MI dashboard for a set of business users, and I often get requests from these users for basic reports for the granular data. I want to build a self service reporting tool within this dashboard; The solution that I envisage is a worksheet with form...
  20. M

    MAC Question: Microsoft ActiveX Data Objects

    I code almost exclusively for PC, but occasionally have to code for MAC. I often write SQL to query data and I typically use the Microsoft ActiveX Data Objects 6.1 Library. When running such code on the MAC, the user received a Can't find project or library error. This occurred on the line of...

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
Back
Top