arcGIS map program connecting to SQL Server

  • I have joined a SQL database table and all records show up as null. I click on the points with the Identifier thing and they still show up as null. HOWEVER!!! I downloaded XTools Pro to make centroids and if you use the Identifier that comes with that program and click on the same point you get all the information attached by SQL database table join! What is up? I can't do selections on it because ArcMap doesn't seem to know it is there but XTools Pro does. What I was trying to do was join a text field in the attribute table to a char field in the SQL. That seems impossible. SO what i did was create a table in the SQL that had some of my records in a field that was a "varchar" field. i chose that because that it what all the fields from the attribute table exported as when moved into the sql one time. anyway. so i make this test table that has two varchar columns. it links. and all data is visible... BUT when i change it to char that make it not join. so whatever, right?? nope because when you change it back to varchar. it won't link again. ever again. thus i don't think my data in sql will ever link because it was, once upon a time, entered in as "char". any suggestions? 

  • CHAR adds trailing spaces until the column is full.  When you convert to VARCHAR, those spaces are retained and that's probably what is making the join fail.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You are a genius I tested that on one record and it showed up immediately. Now I just need to figure out a way to delete all those extra spaces. Any ideas? Again though thank you so much that problem was really killing me. No one on ESRI’s forums could solve it and I also tired two other SQL forums, but no one would even response!!!

  • That's because all the good guys are on this forum

    You can get rid of the trailing spaces by updating the VARCHAR columns kinda like this...

    UPDATE yourtablename

       SET somevarcharcolumn    = RTRIM(somevarcharcolumn),

           anothervarcharcolumn = RTRIM(anothervarcharcolumn

    And thanks for the feedback, Andrew... you certainly made my day!

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply