Improve company productivity with a Business Account.Sign Up

x
?
Solved

import a text file into SQL using VBS / powershell

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

Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
You have missed a phone call. The number looks like it belongs to the bunch of numbers which your company uses. How to find out who has just called you?
Screencast - Getting to Know the Pipeline
Did you know PowerShell can save you time with SaaS platforms? Simply leverage RESTfulAPIs to build your own PowerShell modules. These will kill repetitive tickets and tabs, using the command Invoke-RestMethod. Tune into this webinar to learn how…

585 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