MS Access DB with Spaces in Column Name

Good Afternoon-
I'm having some serious headaches with a table that I need to extract information from. The powers that be wrote it with the following column names "Contract Number" , "Customer Number", "Description".
Note the spaces in the columns.
Sample code from here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2691&lngWId=2
I'm using sample code for connecting to the database and I can access everything using the select statements, except if the column contains a space. I get the following errors:
s.execute("select [Customer Number], Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
s.execute("select \"Customer Number\", Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
s.execute("select Customer*Number, Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
s.execute("select 'Customer Number' , Name from Customer");
Data from column_name: Customer Number , Unknown
This works, but would require parsing-
s.execute("select * from Customer");
Data from column_name: 5 , Unknown
Suggestions would be truly appreciated.
Jason

"select [Customer Number] , Name from Customer " ;
returned the correct responses.Double quoted identifiers, which is part of ANSI SQL should have solved it....
"select \"Customer Number\" , Name from Customer " ;
As mentioned above it has certainly been my experience that DBAs (those with that title) all insist that quoted identifiers should never be used. Thus refactoring the database identifiers is actually the correct solution.

Similar Messages

  • Removing spaces in column names

    Hi
    I have imported a number of tables from a legacy db. The column names in tables have spaces in them. Is there a script I can run to remove spaces from column names in all tables?
    Thanks
    Regards

    First of all, I do not agree with the concept of changing the column names. There is a good chance of breaking your code, if the table has been referred in procs/functions etc.
    One good method would be, import the tables from legacy db into staging and then insert into your actual tables by mapping the tables correctly where your actual table would not have the [space].[Here, I assume your procs/functions etc refer only your actual
    tables not staging tables].
    OR, if you are looking for a plain logic, then use the below:
    The below script wont execute the change, but just would give the statements to be executed to make the column modifications. This is intentional, because this is not a good practice and you can verify the objects and scripts rather than executing it directly.
    create table test_table([column test space] int)
    --select * From test_table
    --Script to do the change in column name
    select 'EXEC sp_rename '''+ B.name+'.'+a.name +''', '''+replace(a.name,' ','') +''', ''COLUMN''' from sys.columns A
    Inner join sys.tables B on A.object_id = B.object_id and OBJECTPROPERTY(b.object_id, N'IsUserTable') = 1
    where
    system_type_id in
    (select system_type_id From sys.types ) and charindex(' ',a.name)<>0
    EXEC sp_rename 'tbl_apas_t_tech.application id', 'applicationid', 'COLUMN'
    EXEC sp_rename 'test_table.column test space', 'columntestspace', 'COLUMN'
    Drop table test_table
    EDIT: Formatting...

  • IWeb and uploading jpegs with spaces in their names

    I have created a site with about 100 jpegs that I wish to load up to a server other than ".Mac". Some jpegs have spaces in their names, so "Fetch" will not upload them. I deleted the spaces from their names and loaded the jpegs back into the site and saved and published to a folder. However, the resulting "Site"folder shows the jpegs still have spaces in their names, even though I removed them from the name of the jpeg. IWeb must be getting the name from some internal tag or something. For example, I had a jpeg called "Billie Holiday.jpg" I changed the name to "BillieH.jpg", but when I publish the site to a folder, the jpeg still shows up as "Billie Holiday.jpg" and therefore I cant upload it using "Fetch". Where is iWeb getting the names of the jpegs from, and how do I remove the spaces? Or, does anybody know of an application that can upload files (ftp) with spaces in their names?
    Thanks,
    Mitch

    However, the resulting
    "Site"folder shows the jpegs still have spaces in
    their names, even though I removed them from the name
    of the jpeg.
    Very strange. You might try renaming the site with Inspector to something else than Site and republishing, to guarantee you have a totally new set of files.
    Or, does
    anybody know of an application that can upload files
    (ftp) with spaces in their names?
    It's not the ftp program. You can't have spaces in file names on most web servers, they won't accept the files.

  • Jar and classpath with space in folder name?

    Hi, all.
    Just for fun: what if I have a jar file that is dependant on the other jar file which is placed in folder with space in its name? How would I link it in manifest file?
    Thanks.

    Havae you tried quoting the Class-Path value?

  • MS Access Tables WIth Spaces

    Hi Everyone,
    I am trying to write an application which requires connection to an old MS Access database. Unfortunately some of the tables have spaces in the names. I can query all tables except those with spaces in the table names. I searched for how to quote tables with spaces in the FROM clause on the net and have tried the following:
    // Angled quotes
    String sql = "Select * From `Function Groups`";
    // double quotation marks
    String sql = "Select * From \"Function Groups\"";
    // single quotation marks
    String sql = "Select * from 'Function Groups'"
    // square brackets
    String sql = "Select * from [Function Groups]"
    I have set setEscapeProcessing to be both TRUE and FALSE in various trials as follows:
    stat.setEscapeProcessing(true);
    All of the above throws an exception from the Access Driver stating I have an error in the From Clause (Yes, there is a table called Function[space]Groups in the database). I am using the free MS Access driver which comes with Vista to connect to the read-only database via JDBC.
    I cannot just exchange spaces for underscores for other reasons.
    Does anyone know the special character used by the Access Driver to parse tables with spaces? Square brackets works with field names but not tables names :(
    All help appreciated,
    Tom

    Doh! missed out a keyword not a quoting problem at all - for interest angled quotes (`) work around the spaces in the table names.

  • Unable to access files with spaces in the path

    Hi all, I am accessing files which reside on the server using a java applet.
    The typical path of a file could be:
    http://192.168.0.2/agat/data/AF190701 0003.agt
    (not the space in the filename).
    When I try to open this file using a URL object:
    URL file = new URL(filename);
    BufferedReader in = new BufferedReader(new InputStreamReader(file.openStream()));
    I get exception 400 ( I think) whihc I assume is file cant be found.
    However when I rename the file (to get rid of that space) and also change the filename variable to suit. The file is opened as expected.
    What should I do to make the applet able to open paths with spaces? Or is this just not possible.
    I did try including quotes with the special characte precessor:
    filename = "/"http://192.168.0.2/agat/data/AF190701 0003.agt/""
    But this didnt work either, please could someone tell what I need.
    Thanks.

    Thanks guys, although before I got your replies I did the following - it seems to work, but shall try your suggestions.
    while (file.lastIndexOf(" ") >0)
    String temp;
    int num = file.lastIndexOf(" ");
    temp = file.substring(0, num) + "%20" + file.substring(num+1, file.length());
    file = temp;
    }

  • How to insert data into datagrid dynamically and also programatically with data and column names being retrived from a xml file..

    iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap

    A DataGrid is row-based rather than cell-based with each row
    corresponding to an item in an underlying collection (specified in the
    dataProvider property). In order to add data to a DataGrid you
    manipulate the underlying collection, rather than the grid directly.
    Based on the limited description of your problem I would imagine you
    would need to create dynamic objects with property names that correspond
    to the dataFields of your dynamically created datagrid columns.
    So if you had created columns with dataFields "alpha", "beta" and
    "gamma" on your datagrid, you could create an item in your grid by
    adding the following object to your dataProvider:
    var gridItem : Object = new Object();
    gridItem.alpha = "alphaValue";
    gridItem.beta = "betaValue";
    gridItem.gamma = "gammaValue";

  • Mplayer can't play files with spaces in their name

    After scratching my head and reinstalling codecs several times without luck, and old memory resurfaced of this occuring before and I managed to solve the problem.
    The thing is that if you doubleclick a file in Nautilus, and said files has spaces in its name, mplayer won't be able to play it, and gives a very cryptic error message, ie "cannot play file a%20b.avi" if the name of the file is "a b.avi".
    The trick is mentioned in this thread -- you edit /usr/share/applications/mplayer.desktop and change 'Exec=gmplayer %U' to 'Exec=gmplayer %F'.
    The bug has been around forever, and hasn't been fixed yet. Perhaps the mplayer devs don't want to fix it. In any case, I would propose that either we fix this in the mplayer Arch package, or that someone more knowledgeable than I get in touch with the devs about it.
    Just a suggestion, but I think it's kind of important. It's really confusing to new users.

    In my opinion, it it's not arch's job to fix bugs from upstream, no matter if it's mplayer or gnome's fault. Of course there are exceptions, eg if a bug in a critical package hardlocks the whole system, or adds a huge security risk.
    I would like to belive that the general arch user is smart enough to find one of the 30 threads about this bug (or the entry on the bugtracker) and fix it themselves. Personaly I would put this in the same category as packages that don't have a .desktop file at all from upstream.
    Oh, and as a small sidenote: http://phraktured.net/patching-patching-patching.html

  • Export of schema with space it its name

    we have a schema named "Gestion Loaners" (note the space in schema name) in oracle 9iR2 database. i want to take schema level export but as there is space in schema name i am not able to do it using either escape char or using parameter file..
    can anyone guide me pls
    thx

    It works if the Username is ALL CAPITALS. Couldn't get it work if the Username was Mixed Case
    SQL> create user "PAVAN KUMAR" identified by pavan;
    User created.
    SQL> grant create session, create table to "PAVAN KUMAR";
    Grant succeeded.
    SQL> create table "PAVAN KUMAR".his_table (col_1 varchar2(5));
    create table "PAVAN KUMAR".his_table (col_1 varchar2(5))
    ERROR at line 1:
    ORA-01950: no privileges on tablespace 'USERS'
    SQL> alter user "PAVAN KUMAR" quota unlimited on USERS;
    User altered.
    SQL> create table "PAVAN KUMAR".his_table (col_1 varchar2(5));
    Table created.
    SQL>
    ora10204>exp hemant/hemant owner=\"PAVAN KUMAR\"
    Export: Release 10.2.0.4.0 - Production on Wed Nov 5 22:33:47 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P1 character set (possible charset conversion)
    About to export specified users ...
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user PAVAN KUMAR
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions for user PAVAN KUMAR
    About to export PAVAN KUMAR's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    . about to export PAVAN KUMAR's tables via Conventional Path ...
    . . exporting table                      HIS_TABLE          0 rows exported
    . exporting synonyms
    . exporting views
    . exporting stored procedures
    . exporting operators
    . exporting referential integrity constraints
    . exporting triggers
    . exporting indextypes
    . exporting bitmap, functional and extensible indexes
    . exporting posttables actions
    . exporting materialized views
    . exporting snapshot logs
    . exporting job queues
    . exporting refresh groups and children
    . exporting dimensions
    . exporting post-schema procedural objects and actions
    . exporting statistics
    Export terminated successfully without warnings.
    ora10204>

  • Libproxy.so eat out the last past of my request with space in the name

    Hi,
    I used the following 2 configurations:
    1. Solaris: iPlanet Web Server WebLogic 6.1
    2. W2000: IIS WebLogic 6.1
    Both of the web server just work as a gateway. All static and dynamic pages (images, JavaScript file, CSS file) are served by the WebLogic Server. (This sounds a little bit wierd. So we dropped this kind of configuration already.)
    I configured both the Web server to forward all requests with "*/portal/*" to WebLogic server. It works fine except the requests with space inside. For example:
    http://localhost:8080/portal/abc def.html
    (I encode space to when I type it in browser).
    And I got a 404 error. (The file is really there.) And I checked both web server's access log, I saw the request for "abc def.html", but when I checked WebLogic's access log, I saw the request for "abc". So I think Weblogic's proxy eats out the last part of my request: "def.html". Of course, WebLogic server could not find a file called "abc" in that directory.
    And finally, in order to test my observation, I created a file called "abc" in that directory. And then the browser shows the content of the file "abc".
    Does anyone see this kind of problem before? I think this is a bug in weblogic's proxy program.

    Hi.
    Are you seeing this in both configurations (ie both iPlanet and IIS)?
    Does the problem go away entirely when you hit the servers directly (ie iPlanet and IIS aren't involved)?
    Are you running any service packs? You should be using service pack 2. If you are not please upgrade and use the plugin from this latest service pack.
    Regards,
    Michael
    Xin Liu wrote:
    Hi,
    I used the following 2 configurations:
    1. Solaris: iPlanet Web Server WebLogic 6.1
    2. W2000: IIS WebLogic 6.1
    Both of the web server just work as a gateway. All static and dynamic pages (images, JavaScript file, CSS file) are served by the WebLogic Server. (This sounds a little bit wierd. So we dropped this kind of configuration already.)
    I configured both the Web server to forward all requests with "*/portal/*" to WebLogic server. It works fine except the requests with space inside. For example:
    http://localhost:8080/portal/abc def.html
    (I encode space to when I type it in browser).
    And I got a 404 error. (The file is really there.) And I checked both web server's access log, I saw the request for "abc def.html", but when I checked WebLogic's access log, I saw the request for "abc". So I think Weblogic's proxy eats out the last part of my request: "def.html". Of course, WebLogic server could not find a file called "abc" in that directory.
    And finally, in order to test my observation, I created a file called "abc" in that directory. And then the browser shows the content of the file "abc".
    Does anyone see this kind of problem before? I think this is a bug in weblogic's proxy program.--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Hyperion IR 9.3.1.3:  Spaces in Column Names

    I have a table that has column names that have spaces. Hyperion IR 9.3.1.3 Studio can query this fine, but IR Web Client can't. In Studio, the query log shows the column names surrounded by quotes, but the Web Client won't even show me the query in the query log. Is there a setting I missed when I published the OCE to the Workspace?

    After checking the Use Quoted Identifiers box in the Advanced Options for the connection, the query works, but I still can't use the Detail View option for the table in the data model.

  • Interactive Report filtering with hidden item column names

    I have created an Interactive Report and changed some of the default column headings by using hidden Items with appropriate title. However, when I look at the filter option in the "Gear" drop-down, the only column names which appear are the default ones. There are blank lines for the columns using hidden Items. Any suggestions for having the hidden item content appear in the filter column name list?
    Thanks,
    George

    George,
    What is it you're actually trying to do here? Maybe there's an easier way?
    Hidden items aren't going to show up in the Column List.
    I'm guessing you're trying to separate a long list of column names using '----------' or something like that? We're looking to do just that in our application, but obviously we don't want to users selecting these dummy entries. We tried using the IR column groups, but those make the list look even more cluttered IMHO. (Plus setting the sort order w/in the groups doesn't seem to affect the drop-down column lists, which seems counter-intuitive to me).
    If anyone has other suggestions for breaking up the column list display, I could use something immediately (going into beta-test in 2 weeks!).
    Thanks,
    Stew

  • SQL Dev converts MS SQL to Oracle - issue with numeric prefix column name

    Hi,
    We're working on migrating MS SQL data into Oracle 10g. An issue we encountered is that some of MS SQL's tables have column names with numeric prefix like 1Q07, 2Q07, ..., 4Q08, and so on. The converted model as well as script can be created. But one thing I notice is that SQL Dev appends a prefix "A" for column names with numeric prefix. This makes sense because Oracle does not allow a column with number. But somehow this does not work with only 4Q
    1Q04 => A1Q01
    2Q07 => A2Q07
    3Q08 => A3Q08
    4Q08 => 4Q08 ???
    Why? Any place in the tool where I can override this?
    Obviously I can manually modify column name 4Q08 to A4Q08 in the script. But by doing this when moving data, it would fail because tool has no knowledge of updated column name.
    Thanks in advance.

    Hi ittichai,
    In <repository>.MIGRATION_TRANSFORMER body
    FUNCTION first_char_check(p_work NVARCHAR2) RETURN NVARCHAR2
    v_allowed := C_DISALLOWED_CHARS || '012356789_$';
    should be
    v_allowed := C_DISALLOWED_CHARS || '0123456789_$';
    If you make this change and convert the 4Q08 will be
    A4Q08 is expected, without any manual rename.
    -Turloch
    Message was edited by:
    Turloch O'Tierney

  • Dynamic UPDATE statement with parameters for column names.

    Hello,
    On this* website I read "The SQL string can contain placeholders for bind arguments, but bind values cannot be used to pass in the names of schema objects (table or column names). You may pass in numeric, date, and string expressions, but not a BOOLEAN or NULL literal value"
    On the other hand, in this Re: execute immediate with dynamic column name update and many other
    posts people use EXECUTE IMMEDIATE to create a dynamic UPDATE statement.
    dynSQL:='UPDATE CO_STAT2 CO SET CO.'||P_ENT_B_G_NAME||' = '||P_ENT_E_G_WE||'
    WHERE ST IN
    (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
    '||P_ST||' = CO.ST AND
    CO.'||P_ENT_E_G_NAME||' > '||P_ENT_E_G_WE||' AND
    CO.'||P_ENT_B_G_NAME||' < '||P_ENT_E_G_WE||');';
    EXECUTE IMMEDIATE dynSQL ;
    Since this statement is part of a Stored Procedure, I wont see the exact error but just get a ORA-06512.
    The compiling works fine and I use Oracle 11g.
    http://psoug.org/definition/EXECUTE_IMMEDIATE.htm

    OK I extracted from all of your posts so far that I have to use "bind-variables with :"
    From all the other tuorials and forums posts, I assume using the pipe is correct so I added those as well into the script:
    set serveroutput on format wraped;
    DECLARE
    dynSQL VARCHAR2(5000);
    P_ENT_E_G_NAME VARCHAR2 (100) :='test1'; P_ENT_E_G_WE VARCHAR2 (100) :='01.02.2012'; P_ENT_B_G_NAME VARCHAR2 (100) :='01.01.2012';
    P_ST                VARCHAR2 (100) :='32132';
    BEGIN
    dynSQL:= 'UPDATE CO_STAT2 CO SET CO.'||:P_ENT_B_G_NAME||' = '||:P_ENT_E_G_WE||'
                  WHERE ST IN (SELECT ST FROM STG_CO_STAT2_TEST CO WHERE
                  '||:P_ST||'                           = CO.ST                  AND
                  CO.'||:P_ENT_E_G_NAME||'     > '||:P_ENT_E_G_WE||' AND
                  CO.'||:P_ENT_B_G_NAME||'    
    < '||:P_ENT_E_G_WE||')';
    --this is somehow missing after the last < '||:P_ENT_E_G_WE||')';
    dbms_output.enable;
    dbms_output.put(dynSQL);
    --EXECUTE IMMEDIATE dynSQL;    
    END;Problem:I think I figured it out, the dates that I parse into the query need additional '

  • Access FTP with whitespaces in dir names

    Hi, 
    I'm trying to make a recursive list of files in an FTP directory.
    While FileZilla deals with whitespaces in directory names with no problem, it seems that Labview struggles a bit.
    Indeed, if I ask labview to get the files and directory of a folder named, for instance, /Projects/Camera 1/, it will return an empty array (while FileZilla clearly sees 12 files in this folder). It seems that the problem is the whitespace in the name because if I replace (using FileZilla) the space character with "_", LV correctly gives me the file list.
    Any idea how to make the LabView FTP function correctly deal with whitespaces in directory and file names?
    Best regards,
    perper2001

    peper2001 wrote:
    FYI, it works OK with the MLSD function.
    That is very possible. I haven't checked the FTP RFC in a while. Most likely they added those new commands to accomodate these new things explicitedly. Doesn't have to mean that an FTP server couldn't support quoted paths with the standard commands, but that is a feature of your FTP server, not of the client you use to talk to the server. So LabVIEW can't do anything about this here. It is mainly a feature that your FTP server has to provide and there might be differences between different FTP servers.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for