Solved

import a text file into SQL using VBS / powershell

Posted on 2011-02-23
5
1,076 Views
Last Modified: 2012-05-11
could somebody post a sample script of how to import text files into a sql table.
0
Comment
Question by:CaptainGiblets
  • 3
  • 2
5 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 34962227
What SQL server?
Mysql, mssql2005,2008, access?
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 34962238
2008
0
 
LVL 37

Accepted Solution

by:
Neil Russell earned 500 total points
ID: 34962255
Why not just use SQL's BULK INSERT ?

BULK
INSERT TABLENAME
FROM 'c:\csvfile.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
0
 
LVL 6

Author Comment

by:CaptainGiblets
ID: 34962312
i only have the express version and i am running a ps file that exports all the event logs to my servers to a folder, so there will be around 30 different files to import daily after the ps file has ran.
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 34962319
Or register for a free account here IF you dont already have one and read this....

http://www.sqlservercentral.com/articles/powershell/65196/
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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