Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

import a text file into SQL using VBS / powershell

Posted on 2011-02-23
5
Medium Priority
?
1,235 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 2000 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

Ready for your healthcare security check-up?

In the past few years, healthcare organizations have become a prime target for advanced attacks. Does your organization have what it needs to defend itself? Schedule your healthcare security check-up today and download our free Healthcare Security Resource Kit today!

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/receā€¦
Loops Section Overview
Screencast - Getting to Know the Pipeline

971 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