Setting up line returns for varchar fields

  • I have a client that once a year has me create and populate a form in our database with all of their goals that they entered in a different database table. In prior years I have pulled a list of the employee goals and entered them into an Excel spreadsheet with a semicolon separating the fields and then have a DTS process that loads the data into a temp table.

    This year, the client has requested that, if possible, we use line returns between each of the goal titles instead of a semi-colon.

    My question is, in the Excel spreadsheet, how can I set up line returns that will carry over when I run my DTS process? If I do ALT+Enter after each goal title, will it carry over into my SQL Varchar field, or is there another character set that I could enter to have this work.

    As an example:

    In prior year's I would have a single Excel cell with this data: GoalName1;GoalName2;GoalName3;GoalName4

    This year I want the following to carry over from the Excel cell:

    GoalName1

    GoalName2

    GoalName3

    GoalName4

    And then have it display correctly in our application.

  • maureen,

    You might want to look here. Just keep your semicolon in the excel spreadsheet, but then split the words apart with one of the several excellent methods mentioned there.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

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

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