Posted on 2011-10-13
Last Modified: 2012-05-12
pls help. i need to update a table where 2 fields were made larger.  the select statement like this seems to work

select substring(macro1,1,71)+'       '+

i want to update substring(macro1,1,71) to substring(macro1,1,71)+'       '+

please help.  Thank you.
Question by:poporon5
    LVL 75

    Expert Comment

    by:Aneesh Retnakaran
    update tableName
    set macro1 = substring(macro1,1,71)+'       '+substring(macro1,72,2000)
    LVL 15

    Expert Comment

    Update TableName
    SET ColumName = substring(ColumName ,1,71)+'       '+substring(ColumName ,72,2000).
    LVL 22

    Accepted Solution

    You can use STUFF instead of SUBSTRING
    SELECT STUFF(macro1,72,0,'       ')

    Open in new window

    Test the SELECT query first before updating
    UPDATE tablename 
    SET macro1 = STUFF(macro1,72,0,'       ')

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now