Solved

SQL Import Record From A Text File

Posted on 2011-03-02
9
187 Views
Last Modified: 2012-05-11
I extracted a record from the DEV Dbase.  I need to import into the QA Dbase.  How do I import the record from a text file?

0
Comment
Question by:CipherIS
9 Comments
 
LVL 40

Expert Comment

by:Sharath
ID: 35021691
Bulk insert the data from text file.
BULK INSERT your_table FROM 'C:\TxtFile.txt' WITH (FIELDTERMINATOR = ' |',,ROWTERMINATOR =' |\n')

Open in new window

http://msdn.microsoft.com/en-us/library/ms188365.aspx
0
 
LVL 32

Expert Comment

by:ewangoya
ID: 35021746

Or you can use the import wizard,
In SSMS, right click on the database you want to import data into, select All Tasks-> Import Data and follow the wizard
0
 
LVL 40

Expert Comment

by:Sharath
ID: 35021788
Do you have Dev and QA databases on same server or different servers?
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 1

Author Comment

by:CipherIS
ID: 35021821
1.  Don't have permission to use Bulk Insert.
2.  Dbases are on Diff Servers.
3.  Data in one column has comma's in it so SSIS is not working well.
0
 
LVL 39

Expert Comment

by:lcohan
ID: 35022124
If is a csv type file you could use : Q306397 HOWTO: Use Excel with SQL Server Linked Servers and Distributed Queries

http://support.microsoft.com/kb/306397
0
 
LVL 40

Expert Comment

by:Sharath
ID: 35022501
You can try any of these options - http://www.mssqltips.com/tip.asp?tip=1207
0
 
LVL 4

Expert Comment

by:samijsr
ID: 35025500
If you have permission to Run Ad Hoc Query then Save your Text file in Excel format and
Insert trhtough Sq=elect statement, make sure that number of columns are same and datatype matched.

Insert Into Table1
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
   'Excel 8.0;Database=c:\book1.xls', Sheet1$)

Ususally Ad HOC Query is Off so set Surface Area configuration to 1 and then Run the above Query
0
 
LVL 1

Accepted Solution

by:
CipherIS earned 0 total points
ID: 35180547
The resolution was to write a SQL BCP script
0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 35221133
Figured it out
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need some help wiht :CAST AS Double 11 46
insert query with value having 's 2 54
Selection from table2 where criteria for table1 10 45
Query to return total 6 19
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

803 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