Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 367987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:46:51+00:00 2026-05-12T13:46:51+00:00

I have a storedproc which takes an ntext field where some records are passed.

  • 0

I have a storedproc which takes an ntext field where some records are passed.
Suppose there is a table t as below.

| ID | Name | Designation|
--------------------------
| 1  | ABC  | Team leader|
| 2  | DEF  | Developer  |
| 3  | XYZ  | Manager    |

I am sending two more record as ‘4|Tom|Developer; 5|John|Team Leader;’
The above string contains column values separated by ‘|’ and rows are separated by ‘;’.
So if I pass the string as the ntext type parameter of the storedproc and need to insert the rows into the table then how to do this?

What is the best way to implement bulk insert in a table in sql server 2005?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T13:46:51+00:00Added an answer on May 12, 2026 at 1:46 pm

    Have you had a look at the Bulk Insert tsql examples from file (can you save to file first?

    BULK INSERT AdventureWorks.Sales.SalesOrderDetail
       FROM 'f:\orders\lineitem.tbl'
       WITH 
          (
             FIELDTERMINATOR =' |',
             ROWTERMINATOR =' |\n'
          )
    

    Otherwise you will have to split the rows, loop these and split the fields

    use split as

    CREATE FUNCTION [dbo].[SplitString]
    (
            @String VARCHAR(MAX) ,
            @Delimiter  VARCHAR(10)
    )
    RETURNS @RetTable TABLE(
            String varchar(MAX)
    )
    AS 
    BEGIN
        DECLARE @i INT ,
                @j INT
        SELECT  @i = 1
        WHILE @i <= LEN(@String)
        BEGIN
            SELECT  @j = CHARINDEX(@Delimiter, @String, @i)
            IF @j = 0
            BEGIN
                SELECT  @j = LEN(@String) + 1
            END
            INSERT  @RetTable SELECT SUBSTRING(@String, @i, @j - @i)
            SELECT  @i = @j + LEN(@Delimiter)
        END
        RETURN
    END
    

    This will always be a maintinace nightmare though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored proc which unions some data and returns back. At max
I have a stored proc, SP1, which executes and does select on one table.
I have a button clicking which a storedproc runs for long time in buttons
I need to search in a table for items which have all of my
I have the code below running in my application and it takes approx 2
I am trying to write a stored procedure that takes a table name as
I have a MS SQL 2005 stored proc which takes an out parameter. How
Currently I have a stored proc, which takes a string @vari as varchar(30) if
Consider the table SAMPLE: id integer name nvarchar(10) There is a stored proc called
I have a Stored Proc which performs search on records. The problem is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.