• oliver.morris (5/29/2015)


    Hi and many thanks for your help in advance. I am looking for a way to convert the following format into a sql table. For those of you familar with the format it is Bib Tex.

    Essentially a new row in the table would be for each entry, denoted by an @ logo and each column is denoted by an =, as you can see from the example data no one contains all the possible columns and some fields can be over two lines long.

    To load this I was considering loading it into a table as each line being a row. Adding a row number, then a column counting the @ signs in order and essentially grouping each record, then for each group running through and looking for the column keywords 'author' , 'title' etc then splitting the data out into those constituent parts using substring and charindex.

    Does this sound like the right approach.

    Many Thanks for your help and suggestions,

    Oli

    @Book{hicks2001,

    author = "von Hicks, III, Michael",

    title = "Design of a Carbon Fiber Composite Grid Structure for the GLAST

    Spacecraft Using a Novel Manufacturing Technique",

    publisher = "Stanford Press",

    year = 2001,

    address = "Palo Alto",

    edition = "1st",

    }

    @Book{Torre2008,

    author = "Joe Torre and Tom Verducci",

    publisher = "Doubleday",

    title = "The Yankee Years",

    year = 2008,

    }

    @INPROCEEDINGS {author:06,

    title = {Some publication title},

    author = {First Author and Second Author},

    crossref = {conference:06},

    pages = {330--331},

    }

    @PROCEEDINGS {conference:06,

    editor = {First Editor and Second Editor},

    title = {Proceedings of the Xth Conference on XYZ},

    booktitle = {Proceedings of the Xth Conference on XYZ},

    year = 2006,

    month = oct,

    }

    It might seem obvious but I want to make sure...

    1. Do you want to capture the fact that the items after the @ symbol change?

    2. In the case of things like "hicks2001" "conference:06", what do you want done with THAT data?

    3. What do you want done with the braces and double quotes around the items?

    Maybe it would be easier to just ask you what the data from above should look like in a table?

    --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)