OO4O VBA SQL

I tried posting in the other forum 0040, thousands of views, but no replies.... to most of the questions in that forum, so going to try my luck in here, please help if you use OO4O and VBA for Excel 2003.
I have been able to successfully connect to the database and execute a few Select Statements and bring that data back into Excel, but I am having trouble executing a DDL Create Table Statement, here is my code, please help, not sure what is going on. I have the drivers for OO4O installed in XP and "Oracle InProc Server 5.0 Type Library" is checked marked for use.
All the examples that I seen reading Docs is to Create a Table with Datatypes and then do inserts, I have no seen:
create table tablename as (select * from table where blablabla);
Can this be done or do I have to employ some other trick, I don't see doing insert as an option, I am dealing with milliosn of records, and that is not even an option, I have to do a create table as .....; and fill it with data from the select.
Ok, I am making this Excel VBA thing that will execute a series of queries and bring in Analysis Data, the first step that I need to do is execute a DDL query to create a Table:
Any variables that hold data are in the code, I just simplified it and removed them, that all is good, I put watch on them to see what values they got.
Sub Process_AdHoc_Analysis_Report()
Dim OraDynaset As Object
Dim objSession As Object
Dim objDataBase As Object
Dim sql1 As String
Set objSession = CreateObject("OracleInProcServer.XOraSession")
Set objDataBase = objSession.OpenDatabase("database", schema & "/" &
password, 0&)
sql1 = "create table " & tablename & "_1" & " as select * from table
where cmpgn_id='" & campaignid & "';"
objDataBase.ExecuteSQL (sql1) <-- here is the error "Run-time error
*'440': Automation error*
End Sub

Hi,
Glad to hear that you have found the solution. Thank you for coming back and let us know the result:)
Best Regards,
Tracy
Tracy Cai
TechNet Community Support

Similar Messages

  • Error when re-starting an SQL Server Instance from VBA - [SQL-DMO]Service Control Error: Access is denied.

    Our Application needs to have the use of the [Named Pipes] and [TCP/IP] Protocols.  To save our Users the hassle of having to enable them manually our application has always done it for them and then stopped and restarted SQL Server.  However
    since the advent of Vista and Windows 7, the restart stopped working.  We solved the problem by detecting the failure to re-start and giving Users sufficient instructions for them to do it themselves.  Since this only occurs during installation on
    the Server, this approach has not been too much of a hassle.  However we would like to tidy this up if possible. This the VBA code that is causing the problem:
        obj_SQLServerInstance2.Start _
            g_SQL_UseWindowsAuthentication, _
            SQLServerInstance, _
            UserName, _
            Password
    This still works when run under XP, but fails under Windows 7 with the Error:
    [SQL-DMO]Service Control Error: Access is denied.
    Does anyone know how to resolve the problem?

    This still works when run under XP, but fails under Windows 7 with the Error:
    [SQL-DMO]Service Control Error: Access is denied.
    Hello Brian,
    Under Windows 7 you have to run the VBA script with admin permission, a normal user don't have permissions to start/stop services.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Update target where source ""

    Access 2013. I have two tables with the same structure, ML and MLTemp. I want to update ML from MLTemp whith the fields in MLTemp which are not empty, that is I want to avoid writing an empty value from MLTemp into a field in ML that has a value already.
    Is there a way to do that in VBA/SQL without looping through each field in MLTemp and check if it's not empty?
    Best regards George

    Assuming that there is a primary key/unique index field on which you can join the tables:
    UPDATE ML INNER JOIN MLTemp ON ML.ID = MLTemp.ID SET ML.Field1 = Nz([ML].[Field1],[MLTemp].[Field1]), ML.Field2 = Nz([ML].[Field2],[MLTemp].[Field2]), ML.Field3 = Nz([ML].[Field3],[MLTemp].[Field3]);
    Here, ID is the primary key, and Field1, Field2 and Field3 are the fields to be updated.
    If MLTemp also contains records that don't have a matching ID in ML, you can add them using:
    INSERT INTO ML
    SELECT MLTemp.*
    FROM MLTemp LEFT JOIN ML ON MLTemp.ID = ML.ID
    WHERE ML.ID Is Null;
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Excel 2003 VBA and OO4O

    I have been able to successfully connect to the database and execute a few Select Statements and bring that data back into Excel, but I am having trouble executing a DDL Create Table Statement, here is my code, please help, not sure what is going on. I have the drivers for OO4O installed in XP and "Oracle InProc Server 5.0 Type Library" is checked marked for use.
    Ok, I am making this Excel VBA thing that will execute a series of
    queries and bring in Analysis Data, the first step that I need to do
    is execute a DDL query to create a Table:
    Any variables that hold data are in the code, I just simplified it and
    removed them, that all is good, I put watch on them to see what values
    they got.
    Sub Process_AdHoc_Analysis_Report()
    Dim OraDynaset As Object
    Dim objSession As Object
    Dim objDataBase As Object
    Dim sql1 As String
    Set objSession = CreateObject("OracleInProcServer.XOraSession")
    Set objDataBase = objSession.OpenDatabase("database", schema & "/" &
    password, 0&)
    sql1 = "create table " & tablename & "_1" & " as select * from table
    where cmpgn_id='" & campaignid & "';"
    objDataBase.ExecuteSQL (sql1) <-- here is the error "Run-time error
    '440': Automation error
    End Sub

    Try without "," in the final sql sentence.

  • How can I deal with long sql by the oo4o?

    I am using VB and oo4o to develop a sql executor which is a extention of an old system.
    For some reason, I have to use oo4o v8.1.7 to deal with Oracle Database 8i to 11g.
    But when I send a very long sql(11KB) to it I got a error in the VB enviroment.
    The Err.Description is "automention error. Started object is disconnected by the client.".
    The Err.Number is "-2147417848 ".
    The sql that I send it to the program is a simple select sql that like select a, b, c, substrb(d, 1, 2), substrb(e, 2, 3) .... from A_TBL where A=aa;
    This sql is normally executed by the sqlplus but I got an error by the oo4o.
    When I insert a '' between the 30Xth items, it got exectuted normally.
    ex. select a, b, c, substrb(d, 1, 2), substrb(e, 1, 2) ..... substrb(303th, 3, 4), '', substrb(304th, 1, 2) ... from A_TBL where A = aa;
    How can I deal with this problem? Thanks.

    So how can use this function correctly?By learning what exceptions are, how they're used, and what you can do to deal with them. There's a tutorial here: http://java.sun.com/docs/books/tutorial/essential/exceptions/index.htmlAnd here's a quick overview:
    The base class for all exceptions is Throwable. Java provides Exception and Error that extend Throwable. RuntimeException (and many others) extend Exception.
    RuntimeException and its descendants, and Error and its descendants, are called unchecked exceptions. Everything else is a checked exception.
    If your method, or any method it calls, can throw a checked exception, then your method must either catch that exception, or declare that your method throws that exception. This way, when I call your method, I know at compile time what can possibly go wrong and I can decide whether to handle it or just bubble it up to my caller. Catching a given exception also catches all that exception's descendants. Declaring that you throw a given exception means that you might throw that exception or any of its descendants.
    Unchecked exceptions (RuntimeException, Error, and their descendants) are not subject to those restrictions. Any method can throw any unchecked exception at any time without declaring it. This is because unchecked exceptions are either the sign of a coding error (RuntimeException), which is totally preventable and should be fixed rather than handled by the code that encounters it, or a problem in the VM, which in general can not be predicted or handled.

  • The question about RAW datatype in VBA with OO4O

    Hi all.
    I have developed a sort of VBA program with oo4o.
    When I issued "select rawtohex(saddr),saddr from v$session where rownum < 2" and I displayed the result on excel spread sheet.
    The result was below.
    RAWTOHEX(SADDR)      SADDR
    C0000000E14ADDF0     &#65533;
    I found I couldn't display a raw datatype result without using RAWTOHEX function.
    But, I query the table using "*",such as " select * from v$session" sometime. So I have to display the raw datatype result without using oracle function.
    I heard that the "RAW" datatype is a array of byte, so I used byte array.
    The following is my first idea and the result is wrong.
    The result is 'FF000000......', not 'C000000....'
    Is there any good idea?
    Dim oSession As Object
    Dim oDatabase As Object
    Dim oRs As Object
    Dim cntCol, cntRow As Long
    Dim rowNum, colNum As Long
    Dim sraw() As Byte
    Dim k As Integer
    Dim hexaString As String
    Set oSession = CreateObject("OracleInProcServer.XOraSession")
    Set oDatabase = oSession.DbOpenDatabase(gTargetServer, gUserID & "/" & gPasswd, 0&)
    Set oRs = oDatabase.DbCreateDynaset(gSqlString, 0&)
    cntCol = oRs.Fields.Count
    cntRow = oRs.RecordCount
    ReDim resData(cntRow, cntCol) ' the variant type array to store result
    'To store column title.
    For colNum = 0 To cntCol - 1
    resData(0, colNum) = oRs.Fields(colNum).Name
    Next colNum
    'To store data.
    For rowNum = 1 To cntRow
    For colNum = 0 To cntCol - 1
    Select Case oRs.Fields(colNum).Type
    Case 11
    sraw = oRs.Fields(colNum).Value
    For k = 0 To UBound(sraw)
    hexaString = hexaString & Hex(sraw(k)) '<= here.***********
    Next k
    resData(rowNum, colNum) = hexaString
    Case Else
    resData(rowNum, colNum) = oRs.Fields(colNum).Value
    End Select
    Next colNum
    oRs.MoveNext
    Next rowNum
    I hope I get helps.
    Bill.

    But, I query the table using "*",such as " select * from v$session" sometimeCan't you use
    select rawtohex(saddr) hexaddr, t.* from v$session t
    (if you really need '*' ) ?
    Rgds.

  • Problem with SQL Query in Excel VBA

    I am trying to retrieve data from a SQL table using Excel VBA.  The query will only return data from the first field in the query.  this is the code I am using:
    objGroupConn.Open
    Set objGroupCmd.ActiveConnection = objGroupConn
    objGroupCmd.CommandText = "SELECT GroupName, GroupNotes, GroupTotal, ArrivalTime" _
    & " FROM dbo.tblGroups" _
    & " WHERE((tblGroups.VisitDate)= '" & vdate & "')"
    objGroupCmd.CommandType = adCmdText
    objGroupCmd.Execute
    Set objGroupRecordset.ActiveConnection = objGroupConn
    objGroupRecordset.Open objGroupCmd
    ActiveSheet.Range("BN5").CopyFromRecordset (objGroupRecordset)
    objGroupRecordset.Close
    objGroupConn.Close
    The query is asking for information from 4 fields and only returns GroupName.  Any ideas?

    Hi GAMinTN,
    I can't reproduce your problem, if I created the same table as yours, I can successfully retrieve the data from the table and copy to the specified range.
    I recommend that you firstly check if the table in the database contains the proper data in all the 4 columns. Since the command text can be executed successfully and get the data of one column, it should be able to get the data from the other columns.
    Also please debug your code, check if the objGroupRecordset contains the proper data, and try to execute the SQL statement directly in the Sql Server, make sure the SQL statement is correct.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SQL-Statement with OO4O

    Hello together,
    I post this Question here in
    Re: SQL-Statement with OO4O
    and i should paste my question again in an another database forum.
    now here again:
    I have here following Problem:
    Everthime I make a connection to my database with this code
    Set oSess = Server.CreateObject("OracleInProcServer.XOraSession")
    Set oDB = oSess.DbOpenDatabase(tnsname, user/PWD, 4)
    I get always this Statement in the DB-queue
    SELECT parameter, VALUE
    FROM SYS.nls_database_parameters
    WHERE parameter IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET')
    Can me anyone tell me why I get this statement and how I can disable it?
    Best Regards
    Andy

    Hi,
    What can you do/change?I must ask next week my boss when he is back,
    what kind of changes I can do.
    Can you add a PL/SQL call to DBMS_APPLICATION_INFO into application?my boss must give me the permission to do a call to DBMS_APPLICATION_INFO.
    A way to identify the source of the badly behaving code is required; whether that be within the DB or external of it.I think so too.
    So please wait, until I have talk with my boss, than I will give you the answer you want. Sorry.
    Any other ideas, what I can do without call/changes on the database to find the problem?
    Best Regards
    Andy

  • SQL Query string in VBA Access 2010

    Hi everyone,
    I am writing sql queries in VBA Access 2010.
    Now, i am very new to VBA programming, so i don't know how i have to write te string for the query.
    I mean, are the " a,d _& sings in the good place?
    The query sits behind a button on the form and when i use the form and click on the button i get the following error
    This is the code i wrote:
    Option Compare Database
    Option Explicit
    Private Sub Knop9_Click()
    Dim bedrijf As String
    Dim startdatum As Date
    Dim einddatum As Date
    Dim aantal_uren_jaarlijks As Double
    Dim gevolgde_uren As Double
    Dim resterende_uren As Double
    Dim naam As String
    'Voeg de waarden die ingevuld werden in het form in de variabelen
    Tekst1.SetFocus
    bedrijf = Tekst1.Text
    Tekst3.SetFocus
    startdatum = Tekst3.Text
    Tekst5.SetFocus
    einddatum = Tekst5.Text
    Tekst7.SetFocus
    gevolgde_uren = Tekst7.Text
    Tekst11.SetFocus
    naam = Tekst11.Text
    CurrentDb.Execute "UPDATE Lan_landmeter " _
    & "SET OpleidingsBedrijf =" & bedrijf & " ,Opleiding_startdatum =#" & startdatum & "#,Opleiding_einddatum =#" & einddatum & "#,Aantal_opleidingsuren_vast=20,Aantal_gevolgde_uren =" & gevolgde_uren & ",Aantal_resterende_uren=0" _
    & "WHERE Id_landmeter =" & naam & ""
    CurrentDb.Close
    End Sub
    Did i wrote the query string right?
    Thx

    In Access create a View showing the information you want, then in design mode click View, SQL to see teh SQL you need. now make sure the SQL you build in VBA is exactly the same. so in the Immediate window type a ? then copy paste your code then press Enter
    to see the result, EG:
    ?"UPDATE Lan_landmeter " _
            & "SET OpleidingsBedrijf =" & bedrijf & " ,Opleiding_startdatum =#" & startdatum & "#,Opleiding_einddatum =#" & einddatum & "#,Aantal_opleidingsuren_vast=20,Aantal_gevolgde_uren
    =" & gevolgde_uren & ",Aantal_resterende_uren=0" _
            & "WHERE  Id_landmeter =" & naam & ""
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Monitoring Oracle SQL queries in VBA

    I currently use VBA with Excel to generate reports based on data within an Oracle 9 database. The amount of data is very large and the reports can take a long time to process. I have added status bar progress indicators for the majority of the report processing tasks to inform the user of what is going on.
    The problem is that I need to be able to monitor the progress of the main SQL queries since they take upwards of a few minutes to run each (mainly because I need to rank and order data). I currently use code similar to that shown below to query the database from VBA.
    Sub simpleVersion()
    Dim username As String
    Dim password As String
    Dim sid As String
    Dim objSession As Object
    Dim objdatabase As Object
    Dim OraDynaset As Object
    Dim strSQL As String
    username = "user"
    password = "pass"
    sid = "database"
    ' connect to database
    Set objSession = CreateObject("OracleInProcServer.XOraSession")
    Set objdatabase = objSession.OpenDatabase(sid, username & "/" & password, 0&)
    strSQL = "select latitude, longitude, otherdata from scatter where otherdata > 50 order by latitude, longitude"
    ' This command takes a long time to execute when doing ranks/order bys
    Set OraDynaset = objdatabase.DBCreateDynaset(strSQL, 0&)
    Do While OraDynaset.EOF = False
    'Process the data and put on a spreadsheet
    'Status bar messages can be used here without problems
    OraDynaset.MoveNext
    Loop
    Set OraDynaset = Nothing
    Set objSession = Nothing
    objdatabase.Close
    Set objdatabase = Nothing
    End Sub
    When the DBCreateDynaset command is executed VBA waits until the dynaset data is retrieved from oracle. I would like to be able to do something similar to the pseudo code below.
    Execute SQL to create dynaset
    Do while still obtaining dynaset
    Check v$session_longops - Indicate time taken / remaining on status bar
    Loop
    I have found that if you execute a large query without any tasks that require the whole dataset before they can begin (ranks, ordering etc) the dynaset is created almost instantly and excel does not freeze up.
    With non dynaset operations such as inserts it is possible to run the query in non blocking mode. I am able to monitor the progress of the query and indicate it to the user.
    Dim myStatement As OraSqlStmt
    Set myStatement = objdatabase.CreateSql(strSQL, ORASQL_NONBLK)
    Do While myStatement.NonBlockingState = ORASQL_STILL_EXECUTING
    DoEvents
    Select Case intSpinCount
    Case 1
    Application.StatusBar = "Please Wait. Calculating data /"
    Case 2
    Application.StatusBar = "Please Wait. Calculating data -"
    Case 3
    Application.StatusBar = "Please Wait. Calculating data \"
    Case 4
    Application.StatusBar = "Please Wait. Calculating data |"
    intSpinCount = 0
    End Select
    Application.Wait TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 1)
    intSpinCount = intSpinCount + 1
    Loop
    Non blocking mode is explained here. However dynasets are not supported.
    http://download-west.oracle.com/docs/cd/A91202_01/901_doc/win.901/a90173/o4o00022.htm
    I have tried using pl/sql to insert the data requested into a temporary table and then the normal select statement to get the data back out. However since the data stored in a table is not ordered it isn’t much help to me since I still have to do the order by command.
    Anyone got any ideas?
    All help is much appreciated.

    Dear taktang
    I'm a newbie. I'd be grateful if you would tell me where to find "oracle-base"
    thanks
    mik3

  • BOXI corrupts SQL when VBA is used with @Script to return SQL fragments

    Under BO 6.5, using @Script functionality, VBA could be used to construct a SQL fragment, or a whole SQL statement, and return it for use within a Data Provider.
    BOXI 3.1, however, tries to be more helpful. For string variables, it adds extra quotes after a variable is populated by VBA (basically it surrounds the generated string with single quotes, then also doubles up any single quote within the string). For numeric variables, it replaces any commas with periods. Bizarrely, it also replaces semi-colons with commas, but then it will add spurious surrounding brackets.
    Broadly, I can see that the developers are trying to help. "You seem to be returning a string, allow me to quote it for you." "Oh, that looks like a number with an embeddded comma. Let me assume you really meant a decimal place." In fact, of course, BOXI's helpfulness destroys the integrity of any SQL generated by VBA.
    Does anybody know, please, some way of returning a value from VBA to a BOXI Data Provider in such a way that BOXI leaves it unmodified?
    Thanks,
    Dave

    Under BO 6.5, using @Script functionality, VBA could be used to construct a SQL fragment, or a whole SQL statement, and return it for use within a Data Provider.
    BOXI 3.1, however, tries to be more helpful. For string variables, it adds extra quotes after a variable is populated by VBA (basically it surrounds the generated string with single quotes, then also doubles up any single quote within the string). For numeric variables, it replaces any commas with periods. Bizarrely, it also replaces semi-colons with commas, but then it will add spurious surrounding brackets.
    Broadly, I can see that the developers are trying to help. "You seem to be returning a string, allow me to quote it for you." "Oh, that looks like a number with an embeddded comma. Let me assume you really meant a decimal place." In fact, of course, BOXI's helpfulness destroys the integrity of any SQL generated by VBA.
    Does anybody know, please, some way of returning a value from VBA to a BOXI Data Provider in such a way that BOXI leaves it unmodified?
    Thanks,
    Dave

  • OO4O & VC++ Access Violation with large sql statement

    Using Oracle C++ Class Library OO4O for Oracle9i Version 9.0.1.4.3 for
    Windows 98/NT/2000/XP.
    Open a dynaset with a large sql statemant more then 1000 chars you get
    a Access Violation, like below.
    szSQL = "select..."
    ores = oDyn.Open( odb, szSQL, ODYNASET_READONLY || ODYNASET_NOCACHE);
    The same sql query works without any problem in SQL Plus. A simple SQL statement works fine using OO4O.
    Any ideas?

    I am using Jboss 2.44 with tomcat3.2.3, and I get deployment problems when using jdk1.5, I also tried JBoss 4 but I also have lots of problems with that.
    I have this huge system developed long time ago. I have problems with printing in jdk1.3 so upgrade to 1.4 or higher will fix the printing. Upgrading to jdk1.5 and JBoss 4 will need lots of rewrite which is not an option.
    So to me it seems easier if I keep using jboss2.44 and tomcat 3.2.3 but just upgrade to JDK 1.4. All off this is just because jdk1.3.1 has printing bugs.
    Bushwack, I am ding exactly like you are, the only difference is, ResultSet.CONCUR_UPDATABLE and I used , ResultSet.CONCUR_READONLY. But I tried and still the same error.
    I will try using a new JDBC driver, hope it works, I am just struggling to find a free one

  • OO4O & VC++ Access Violation with large sql statement  - REPOST

    This is a repost - my email address was incorrect on the previous message
    OO4O & VC++ Access Violation with large sql statement
    Using Oracle C++ Class Library OO4O for Oracle9i Version 9.0.1.4.3 for
    Windows 98/NT/2000/XP.
    Open a dynaset with a large sql statemant more then 1000 chars you get
    a Access Violation, like below.
    szSQL = "select..."
    ores = oDyn.Open( odb, szSQL, ODYNASET_READONLY || ODYNASET_NOCACHE);
    The same sql query works without any problem in SQL Plus. A simple SQL statement works fine using OO4O.
    Any ideas?
    [email protected]

    I am using Jboss 2.44 with tomcat3.2.3, and I get deployment problems when using jdk1.5, I also tried JBoss 4 but I also have lots of problems with that.
    I have this huge system developed long time ago. I have problems with printing in jdk1.3 so upgrade to 1.4 or higher will fix the printing. Upgrading to jdk1.5 and JBoss 4 will need lots of rewrite which is not an option.
    So to me it seems easier if I keep using jboss2.44 and tomcat 3.2.3 but just upgrade to JDK 1.4. All off this is just because jdk1.3.1 has printing bugs.
    Bushwack, I am ding exactly like you are, the only difference is, ResultSet.CONCUR_UPDATABLE and I used , ResultSet.CONCUR_READONLY. But I tried and still the same error.
    I will try using a new JDBC driver, hope it works, I am just struggling to find a free one

  • SQL/VBA SDK to view Universe Connection details from CMS

    Hi
    Am trying to find Database Name and User Name from Universe Connections. It looks like all these details are placed as a Property bag. So am looking for VBA code to view the Property bag or any direct Query Builder SQL to fetch these details.
    Please share your Inputs.
    Thanks.

    Hi Ted
    The MetaData DataConnection objects housed in the CMS repository don't have a public API associated with them.
    Thanks for your information. I found the below code from BOB forum which gets Database Name etc from CMS, but am not able to make it work this in VBA (Excel Macro).
    Imports System.Xml
    Public iStore As New CrystalInfoStoreLib.InfoStore
    Public Connections As CrystalInfoStoreLib.InfoObjects
    Public ConnectItem As CrystalInfoStoreLib.InfoObject
    Public ConnectObject As New CrystalConnectionPluginLib.Connection
    Dim QueryStr As String = ""
    Dim ElementStr As String = ""
    Dim NWLayer As String = ""
    Dim RDMS As String = ""
    QueryStr = "select SI_ID, SI_CREATION_TIME, SI_UPDATE_TS, SI_REVISIONNUM,SI_OWNER, SI_DESCRIPTION, SI_NAME, SI_CONNUNIVERSE, SI_METADATA_PROPERTIES from CI_APPOBJECTS where SI_KIND = 'MetaData.DataConnection' and SI_PARENTID=123 order by SI_NAME"
    Connections = iStore.Query(QueryStr)
    For Each ConnectItem In Connections
      Dim sr As New System.IO.StringReader(ConnectItem.Properties("SI_METADATA_PROPERTIES").Properties("SI_METADATA_BVCONN_ATTRIBUTES").Value)
      Dim doc As New Xml.XmlDocument
      doc.Load(sr)
      Dim reader As New Xml.XmlNodeReader(doc)
      While reader.Read()
        Select Case reader.NodeType
          Case Xml.XmlNodeType.Element
            If reader.Name = "Name" Then
              ElementStr = reader.ReadElementContentAsString
                If ElementStr = "NetworkLayer" Then
                  NWLayer = reader.ReadElementContentAsString
                End If
                If ElementStr = "RdmsName" Then
                  RDMS = reader.ReadElementContentAsString
                End If
            End If
        End Select
      End While
    Next
    MsgBox(ConnectItem.Title & vbCrLf & NWLayer & vbCrLf & RDMS)
    Thanks.

  • Excel to SQL via VBA

    Hi friends,
    While the following commands work great when launched from the T-SQL:
    SELECT 'XLS' AS [Version], * 
      from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                      'Excel 12.0; Database=C:\Users\faraz.qureshi\Desktop\OldJunk\Book1.xls; HDR=YES; IMEX=1',
                      'SELECT * from [testdata]')
    UNION ALL
    SELECT 'XLSX', * 
      from OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                      'Excel 12.0; Database=C:\Users\faraz.qureshi\Desktop\OldJunk\Book1.xlsx; HDR=YES; IMEX=1',
                      'SELECT * from [testdata]');
    to import from Excel 2003 as well as Excel 2007+ both, what command could help me to achieve the same without interaction with SSMS, i.e. directly from Excel?
    In other words, suppose I have a named range in excel testrange
    how can I export the same in a new table named Test
    in a database named Test_DB that exists on a server and instance named
    MyComputer\SQL_FAQ.
    Further, is it necessary to close
    the Excel File first? Couldn't I export the selected range of Excel?
    Thanks in advance.
    Thanx in advance, Best Regards, Faraz A Qureshi

    Hi FARAZ,
    Regarding your description, Your requirement is about some programing approach to export excel to SQL Server, which is out of the queue of this forum.
    According to "via VBA" in your question, I would you suggest you post your question to a dedicated
    VBA forum. It is more appropriate and more experts will help you.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

Maybe you are looking for

  • R12.1.1 installation error on linux oel6.1 os

    Hello Sir, I double checked pre requisites of R12.1.1 Installation Note.761566.1 and i am getting following error ./rapidwiz Rapid Install Wizard is validating your file system...... 4 dvd labels found Rapid Install Wizard will now launch the Java In

  • Unity 7 and Lotus Notes migration

                       Customer currently is on Unity 7 with Exchange 2010. They recentlly got bought out and will be migrating over to Dominos. Is there any any sort of migration path so they can still have access to their old voicemails on exchange? wo

  • Media kind is all messed up now....

    I have a ton of music videos, all of which are in mpeg-4 format. The problem is they won't play on my car stereo or ipod because it isn't recognized as a video because the media kind says "music". I can 't switch it to anything like "pod cast video"

  • Monthly subscription serial does not transfer to new Premiere CS6

    I received the e-mails from Adobe about the general new subscription protocol and savings.  I have been using CS5.5 for about a year and Adobe stated the new automatic transfer subscription and new rate savings to CS6.  I however when I enter my mont

  • Imovie Themes Clips

    is there a way to make it so you can add more than just a few photos to the themes in imovie? right now i can only add what they give me per them, which is anywhere from 1-3 depending on the theme.