Download Link:
http://www.microsoft.com/en-gb/download/details.aspx?id=24659
Study Materials:
https://sqlbits.com/Sessions/Event9/LogParser-quicker_than_SSIS_easier_than_BCP
echo off
echo off
cls
cd\
cd "c:\Program Files (x86)\Log Parser
2.2\"
LogParser -i:TSV -iSeparator:"|" "select
BusinessEntityID,PhoneNumber,PhoneNumberTypeID ,ModifiedDate from C:\temp\personphone.csv"
-o:datagrid
LogParser -i:TSV -iSeparator:"|" "select * from
C:\temp\personphone.csv" -o:datagrid -- To select all the rows - This single delimited pipe
works even if the file contains two pipe delimited
LogParser -i:TSV -iSeparator:"|" "select * from C:\temp\personphone.csv
where Rownumber = 10" -o:datagrid -- To select only the specific rownumber
logparser
"select date,cost into
c:\temp\expense.gif from c:\temp\fahimexpense.txt" -i:csv -o:chart -chartType:barstacked
-view:on -values:on
The below logparser will truncate
the data from the table
client2file
create table dbo.client2file (customerid int null,email varchar(100))
go
select * from dbo.client2file
LogParser -i:csv
"select customerid,email
into dbo.client2file from C:\Backup\FTP\client2file15032015.txt"
-o:sql -server:localhost
-database:test -cleartable:ON -transactionRowCount:-1
--The below logparser won't truncate
the data from the table client2file
LogParser -i:csv
"select customerid,email
into dbo.client2file from
C:\Backup\FTP\client2file15032015.txt" -o:sql -server:localhost -database:test -cleartable:OFF -transactionRowCount:-1
The below logparser is
to insert
additional filename and
rownumber column into
the table
create table dbo.client2filewithfilenamerownumber (filename sysname,rownumber int,customerid int null,email varchar(100))
go
select * from dbo.client2filewithfilenamerownumber
LogParser -i:csv
"select filename,rownumber,customerid,email into
client2filewithfilenamerownumber from
C:\Backup\FTP\client2file15032015.txt" -o:sql -server:localhost -database:test -cleartable:ON -transactionRowCount:-1
No comments:
Post a Comment