Import SQL Server data into Excel

Posted on 2011-10-12
Last Modified: 2012-08-14

I have to print a sheet with a list of labels containing the data from SQL Server.
I run a query that extracts data from a SQL server and prints it in three columns.
Please, see the attached excel file for how i need the labels to be formatted.

Each cell has to contain the following data:
ITEM_NO_123 -  item number
English Description - english description
Original description  -  description in original language.

Is it possible to do this? If yes, then how?

Many thanks in advance!
SELECT i.Item, i.Description, l.Description FROM MA_Items i
JOIN MA_ItemsLanguageDescri l ON l.Item = i.Item
WHERE l.Language LIKE 'TR'

Open in new window

Question by:Zaurb
    1 Comment
    LVL 12

    Accepted Solution

    Not sure if this is exactly what you're looking for.  If you can get the three fields as individual strings you can input them into a cell like this.
    Sub CombineThreeStrings()
    Dim s1 As String, s2 As String, s3 As String
    s1 = "ITEM_NO_123"
    s2 = "English Description"
    s3 = "Original Description"
    Range("G6") = s1 & vbNewLine & s2 & vbNewLine & s3
    End Sub

    Open in new window

    Let me know if something needs tweaking or if I missed the boat completely.


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    729 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

    19 Experts available now in Live!

    Get 1:1 Help Now