Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CREATE TABLE STUDENT
(
Name varchar(50),
ID bigint,
EmailId varchar(50),
ContactInfo bigint,
Domain varchar(50)
)

Lets suppose i am declaring Domain as CS for Default.

I am now passing values using BULK INSERT Command

BULK INSERT STUDENT FROM (path of text file)
By bulk Insert I am getting data..But i want individual scripts for



Text file contains

Gaurav,231535,gaurav@xyz.com
Saurabh,235315,saurabh@xyz.com


I want individual scripts for Each row which should be created dynamically.
Posted

1 solution

If you really want to control the insert then:
    1 use ODBC to read the text file, and
    2 SQL to write to your table.

ODBC drivers exist for quite a few formats (EXCEL, FOXPRO, ORACLE, and the rarely use TEXT).

Once you've a (proper) ODBC connection to your text file you can run SELECT queries against it for most of the common SQL operations. There are limitations on what you can do to modify the text file, should that be of interest.
 
Share this answer
 
Comments
gaurav goyal 27-Apr-15 23:13pm    
Hi Balbos Thanks for Answer.
But I want individual script should be created after transferring data from one table to another

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900