Showing posts with label sql2k. Show all posts
Showing posts with label sql2k. Show all posts

Friday, March 9, 2012

importing data issue

Hello,
We are moving our data from one sql2k to another. The initial db has all
of the tables in a primary filegroup. We have created multiple filegroups
for the new server from scripts. When we try to import the data from the old
sql to the new we get a bunch of FK and PK violations. Is this a way to shut
all of these off for the import and then turn them all back on or do we have
to do each table separately? Thanks in advance.
JohnThe PK violations implies that there is something wrong
with the import. You need to make sure the data added is
correct. Something like a different collation could cause
this.
FK - you just need to import the tables in the correct
order. ANother option is to remove all the FKs and add
them after the import.
Given that you seem to have problems wit hthe data I
would make sure the data is checked when the FKs are
added.

Wednesday, March 7, 2012

Importing Data From a Flat File

Hi,

I am trying to import data from a Flat File in SQL Server 2005, this used to be a simple task in SQL2K but for some reason isn't in SQL2K5.

I am only trying to import part of the record not the whole thing and it keeps giving me this error:

**************************************************************

MessagesWarning 0x80047076: Data Flow Task: The output column "Column 3" (19) on output "Flat File Source Output" (2) and component "Source - consumer_0_dat" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
(SQL Server Import and Export Wizard)

Warning 0x80047076: Data Flow Task: The output column "Column 3" (19) on output "Flat File Source Output" (2) and component "Source - consumer_0_dat" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.
(SQL Server Import and Export Wizard)

******************************************************************************

If I delete the columns and only have those that I want inserted then i get column length errors.

Can someone pls provide instruction to import a flat file in my database?

Thanks

These are just Warnings, this should not stop your package from execution, unless there is error happening somewhere else.

Friday, February 24, 2012

Importing an XML file into SQL2K table

Is it possible to import an XML file into a SQL 2000 table? I can't seem to
find any white pages on this.
TIA,
JoeHi,
use OPENXML function
"jaylou" wrote:

> Is it possible to import an XML file into a SQL 2000 table? I can't seem
to
> find any white pages on this.
> TIA,
> Joe
>
>|||Exemple:
declare @.idoc int
declare @.doc varchar(1000)
set @.doc ='
<ROOT>
<Customers CustomerID="VINET" ContactName="Paul Henriot">
<Orders CustomerID="VINET" EmployeeID="5" OrderDate=
"1996-07-04T00:00:00">
<Order_x0020_Details OrderID="10248" ProductID="11" Quantity="12"/>
<Order_x0020_Details OrderID="10248" ProductID="42" Quantity="10"/>
</Orders>
</Customers>
<Customers CustomerID="LILAS" ContactName="Carlos Gonzlez">
<Orders CustomerID="LILAS" EmployeeID="3" OrderDate=
"1996-08-16T00:00:00">
<Order_x0020_Details OrderID="10283" ProductID="72" Quantity="3"/>
</Orders>
</Customers>
</ROOT>'
--Create an internal representation of the XML document.
exec sp_xml_preparedocument @.idoc OUTPUT, @.doc
-- SELECT statement using OPENXML rowset provider
SELECT *
FROM OPENXML (@.idoc, '/ROOT/Customers')
EXEC sp_xml_removedocument @.idoc
I hope to help you.
"jaylou" wrote:

> Is it possible to import an XML file into a SQL 2000 table? I can't seem
to
> find any white pages on this.
> TIA,
> Joe
>
>|||thank you,
I was trying this but my files were larger then 8000 characters and
sp_xml_preparedocument choked evertime I tried.
I had to use FSO to get the file into a global variable then I called a
stored proc to run your attached code.
Thanks again,
joe
"Dio" wrote:
> Exemple:
> declare @.idoc int
> declare @.doc varchar(1000)
> set @.doc ='
> <ROOT>
> <Customers CustomerID="VINET" ContactName="Paul Henriot">
> <Orders CustomerID="VINET" EmployeeID="5" OrderDate=
> "1996-07-04T00:00:00">
> <Order_x0020_Details OrderID="10248" ProductID="11" Quantity="12"/>
> <Order_x0020_Details OrderID="10248" ProductID="42" Quantity="10"/>
> </Orders>
> </Customers>
> <Customers CustomerID="LILAS" ContactName="Carlos Gonzlez">
> <Orders CustomerID="LILAS" EmployeeID="3" OrderDate=
> "1996-08-16T00:00:00">
> <Order_x0020_Details OrderID="10283" ProductID="72" Quantity="3"/>
> </Orders>
> </Customers>
> </ROOT>'
> --Create an internal representation of the XML document.
> exec sp_xml_preparedocument @.idoc OUTPUT, @.doc
> -- SELECT statement using OPENXML rowset provider
> SELECT *
> FROM OPENXML (@.idoc, '/ROOT/Customers')
> EXEC sp_xml_removedocument @.idoc
> I hope to help you.
> "jaylou" wrote:
>|||http://support.microsoft.com/?scid=316005|||Hi, "jaylou"!
Try using "NTEXT" datatype to handle XML strings. Here's an extract for
NTEXT from SQL Server 2000 Books Online:
Variable-length Unicode data with a maximum length of 230 - 1
(1,073,741,823) characters.
So, you have a max possible length of 1,073,741,823 characters available for
your XML...Enjoy!!
Thanks & Regards,
Nakul Vachhrajani
"jaylou" wrote:
> thank you,
> I was trying this but my files were larger then 8000 characters and
> sp_xml_preparedocument choked evertime I tried.
> I had to use FSO to get the file into a global variable then I called a
> stored proc to run your attached code.
> Thanks again,
> joe
>
> "Dio" wrote:
>