Showing posts with label directly. Show all posts
Showing posts with label directly. Show all posts

Wednesday, March 28, 2012

Importing text from a flat text file.

I have a DOS scripts that echo's some PC data to a local log file but instea
d
of writing directly to this log file i'd like the output of this script to
populate an SQL 2000 database. How would i go about redirecting the output
from a flat text file to a SQL database.
Regards
John>> How would i go about redirecting the output from a flat text file to a
Some options include Bulk Insert, BCP IN or DTS. Simply search the index in
SQL Server Books Online & you'll find all the information you need to use
them. Also, for DTS, check out www.sqldts.com
Anith|||"ValleyBoy" <ValleyBoy@.discussions.microsoft.com> wrote in message
news:D54A35D3-BE24-458A-B371-27B0A239B043@.microsoft.com...
> I have a DOS scripts that echo's some PC data to a local log file but
instead
> of writing directly to this log file i'd like the output of this script to
> populate an SQL 2000 database. How would i go about redirecting the output
> from a flat text file to a SQL database.
> Regards
> John
Take a look at bcp, BULK INSERT and osql. I'm not sure which approach will
work with your given situation, or if it's even possible to have it
redirected. You may have to dump it to the flat file and then bcp or BULK
INSERT the data in to SQL Server as part of another batch.
Another possible option is to have DTS run the DOS jobs and do something
with the input. I'm not a DTS expert, so I can't say whether or not this
approach is feasible either.
HTH
Rick Sawtell
MCT, MCSD, MCDBA|||for this you might check DTS available in BOL
alternatively check for osql command in BOL
eg:
osql /U alma /P /i stores.qry
or u can use bulk Insert
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"ValleyBoy" wrote:

> I have a DOS scripts that echo's some PC data to a local log file but inst
ead
> of writing directly to this log file i'd like the output of this script to
> populate an SQL 2000 database. How would i go about redirecting the output
> from a flat text file to a SQL database.
> Regards
> John

Friday, March 23, 2012

importing of XML files into SQL 2000

Hi,
How could i actually import an XML file directly into SQL Server 2000 from
the EM or Query Analyzer
i tried right-click on the tables --> import data but what should the data
source be ?
appreciate ur advise
tks & rdgs
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...er-xml/200602/1Look into SQLXML. So far it is the best way to insert large amounts of XML
data into a table.
"maxzsim via webservertalk.com" wrote:

> Hi,
> How could i actually import an XML file directly into SQL Server 2000 fro
m
> the EM or Query Analyzer
> i tried right-click on the tables --> import data but what should the dat
a
> source be ?
> appreciate ur advise
> tks & rdgs
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...er-xml/200602/1
>|||Hi ,
I am not able to see SQLXML in the Data sources , how can i get that out ,
wat do i need to install ?
appreciate ur advice
tks & rdgs
Sal Young wrote:
>Look into SQLXML. So far it is the best way to insert large amounts of XML
>data into a table.
>
>[quoted text clipped - 7 lines]
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...er-xml/200602/1|||This is one of the examples included in the documentation of SQLXML add-on
component. You'll need your xml file and the schema (xsd) file.
Follow these steps:
1. Go to
http://www.microsoft.com/downloads/...&displaylang=en
and download the SQLXML add-on component. Install it on the machine where
you're going to run the DTS package.
2. Create a new DTS package and add an "ActiveX Script Task"
3. Insert the following code inside the Main() function:
set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
with objBL
.ConnectionString = "provider=SQLOLEDB;data
source=localhost;database=dev;integrated
security=SSPI"
.ErrorLogFile = "C:\error.log"
.SchemaGen = true
.Execute "Salesorderdetail.xsd", "Salesorderdetail.xml"
end with
set objBL=Nothing
This solution works best when importing large amounts of data, otherwise, I
recommend using an "Execute SQL task" to call a stored procedure that uses
OPENXML.
"maxzsim via webservertalk.com" wrote:

> Hi ,
> I am not able to see SQLXML in the Data sources , how can i get that out
,
> wat do i need to install ?
> appreciate ur advice
> tks & rdgs
> Sal Young wrote:
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...er-xml/200602/1
>|||Hi,
search for OPENXML in the SQL Manual.
There you'll get an good example.
Achim
"maxzsim via webservertalk.com" <u14644@.uwe> schrieb im Newsbeitrag
news:5b4210d93706a@.uwe...
> Hi,
> How could i actually import an XML file directly into SQL Server 2000 from
> the EM or Query Analyzer
> i tried right-click on the tables --> import data but what should the data
> source be ?
> appreciate ur advise
> tks & rdgs
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...er-xml/200602/1|||tks u ppl very much =)
Achim Stein [MCT] wrote:
>Hi,
>search for OPENXML in the SQL Manual.
>There you'll get an good example.
>Achim
>
>[quoted text clipped - 7 lines]
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...er-xml/200602/1

importing of XML files into SQL 2000

Hi,
How could i actually import an XML file directly into SQL Server 2000 from
the EM or Query Analyzer
i tried right-click on the tables --> import data but what should the data
source be ?
appreciate ur advise
tks & rdgs
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...r-xml/200602/1
Look into SQLXML. So far it is the best way to insert large amounts of XML
data into a table.
"maxzsim via droptable.com" wrote:

> Hi,
> How could i actually import an XML file directly into SQL Server 2000 from
> the EM or Query Analyzer
> i tried right-click on the tables --> import data but what should the data
> source be ?
> appreciate ur advise
> tks & rdgs
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...r-xml/200602/1
>
|||Hi ,
I am not able to see SQLXML in the Data sources , how can i get that out ,
wat do i need to install ?
appreciate ur advice
tks & rdgs
Sal Young wrote:[vbcol=seagreen]
>Look into SQLXML. So far it is the best way to insert large amounts of XML
>data into a table.
>[quoted text clipped - 7 lines]
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...r-xml/200602/1
|||This is one of the examples included in the documentation of SQLXML add-on
component. You'll need your xml file and the schema (xsd) file.
Follow these steps:
1. Go to
http://www.microsoft.com/downloads/d...displaylang=en
and download the SQLXML add-on component. Install it on the machine where
you're going to run the DTS package.
2. Create a new DTS package and add an "ActiveX Script Task"
3. Insert the following code inside the Main() function:
set objBL = CreateObject("SQLXMLBulkLoad.SQLXMLBulkload.3.0")
with objBL
.ConnectionString = "provider=SQLOLEDB;data
source=localhost;database=dev;integrated security=SSPI"
.ErrorLogFile = "C:\error.log"
.SchemaGen = true
.Execute "Salesorderdetail.xsd", "Salesorderdetail.xml"
end with
set objBL=Nothing
This solution works best when importing large amounts of data, otherwise, I
recommend using an "Execute SQL task" to call a stored procedure that uses
OPENXML.
"maxzsim via droptable.com" wrote:

> Hi ,
> I am not able to see SQLXML in the Data sources , how can i get that out ,
> wat do i need to install ?
> appreciate ur advice
> tks & rdgs
> Sal Young wrote:
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...r-xml/200602/1
>
|||Hi,
search for OPENXML in the SQL Manual.
There you'll get an good example.
Achim
"maxzsim via droptable.com" <u14644@.uwe> schrieb im Newsbeitrag
news:5b4210d93706a@.uwe...
> Hi,
> How could i actually import an XML file directly into SQL Server 2000 from
> the EM or Query Analyzer
> i tried right-click on the tables --> import data but what should the data
> source be ?
> appreciate ur advise
> tks & rdgs
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forums...r-xml/200602/1
|||tks u ppl very much =)
Achim Stein [MCT] wrote:[vbcol=seagreen]
>Hi,
>search for OPENXML in the SQL Manual.
>There you'll get an good example.
>Achim
>[quoted text clipped - 7 lines]
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...r-xml/200602/1
sql