Person.Coontact - AdventureWorks  
Author Message
sreekantht





PostPosted: Tue Feb 07 12:29:59 CST 2006 Top

SQL Server >> Person.Coontact - AdventureWorks

I have the AdventureWorks database in sql server 2005.
The Table Person.Contact is empty. I have the .csv file for the data for
this table. This .csv seems to be xml data.
How can I get this particular .csv into this table?
I basically would like to somehow populate this particular table.
Thanks

SQL Server152  
 
 
Gail





PostPosted: Tue Feb 07 12:29:59 CST 2006 Top

SQL Server >> Person.Coontact - AdventureWorks If you look at the installation script for AdventureWorks (instawdb.sql),
you'll find a series of BULK INSERT statements that load all the .csv files
for the database. Here's the statement for the Person.Contact table. I
simply modified the statement to point to the location of the .csv file on
my server.

EXECUTE (N'BULK INSERT [Person].[Contact]
FROM ''C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks
OLTP\Contact.csv''
WITH (
CHECK_CONSTRAINTS,
CODEPAGE=''ACP'',
DATAFILETYPE=''widechar'',
FIELDTERMINATOR=''+|'',
ROWTERMINATOR=''&|\n'',
KEEPIDENTITY,
TABLOCK
);');

However, unless you know for sure that the Person.Contact table is the only
empty table, you may want to recreate the entire database by running the
installation script. The instructions for doing this are in Books Online in
the topic "Reinstalling Sample Databases From Scripts".

--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights



>I have the AdventureWorks database in sql server 2005.
> The Table Person.Contact is empty. I have the .csv file for the data for
> this table. This .csv seems to be xml data.
> How can I get this particular .csv into this table?
> I basically would like to somehow populate this particular table.
> Thanks


 
 
farshad





PostPosted: Tue Feb 07 15:16:31 CST 2006 Top

SQL Server >> Person.Coontact - AdventureWorks Ran the following script:
EXECUTE (N'BULK INSERT [Person].[Contact]
FROM ''C:\Program Files\Microsoft SQL Server 2005 AdventureWorks Sample
Database Scripts\awdb\Contact.csv''
WITH (
CHECK_CONSTRAINTS,
CODEPAGE=''ACP'',
DATAFILETYPE=''widechar'',
FIELDTERMINATOR=''+|'',
ROWTERMINATOR=''&|\n'',
KEEPIDENTITY,
TABLOCK
);');

It gave the following error. thanks
XML Validation: Declaration not found for element
'http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactRecord:ContactRecord'. Location: /*:AdditionalContactInfo[1]/*:ContactRecord[1]




> If you look at the installation script for AdventureWorks (instawdb.sql),
> you'll find a series of BULK INSERT statements that load all the .csv files
> for the database. Here's the statement for the Person.Contact table. I
> simply modified the statement to point to the location of the .csv file on
> my server.
>
> EXECUTE (N'BULK INSERT [Person].[Contact]
> FROM ''C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks
> OLTP\Contact.csv''
> WITH (
> CHECK_CONSTRAINTS,
> CODEPAGE=''ACP'',
> DATAFILETYPE=''widechar'',
> FIELDTERMINATOR=''+|'',
> ROWTERMINATOR=''&|\n'',
> KEEPIDENTITY,
> TABLOCK
> );');
>
> However, unless you know for sure that the Person.Contact table is the only
> empty table, you may want to recreate the entire database by running the
> installation script. The instructions for doing this are in Books Online in
> the topic "Reinstalling Sample Databases From Scripts".
>
> --
> Gail Erickson [MS]
> SQL Server Documentation Team
> This posting is provided "AS IS" with no warranties, and confers no rights
>


> >I have the AdventureWorks database in sql server 2005.
> > The Table Person.Contact is empty. I have the .csv file for the data for
> > this table. This .csv seems to be xml data.
> > How can I get this particular .csv into this table?
> > I basically would like to somehow populate this particular table.
> > Thanks
>
>
>
 
 
Gail





PostPosted: Wed Feb 08 13:50:18 CST 2006 Top

SQL Server >> Person.Coontact - AdventureWorks > It gave the following error. thanks
Then you have more problems than just an empty table. You need to follow
the instructions in the Books Online topic "Reinstalling Sample Databases
From Scripts". This will drop the database and recreate it.

--
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights



> Ran the following script:
> EXECUTE (N'BULK INSERT [Person].[Contact]
> FROM ''C:\Program Files\Microsoft SQL Server 2005 AdventureWorks Sample
> Database Scripts\awdb\Contact.csv''
> WITH (
> CHECK_CONSTRAINTS,
> CODEPAGE=''ACP'',
> DATAFILETYPE=''widechar'',
> FIELDTERMINATOR=''+|'',
> ROWTERMINATOR=''&|\n'',
> KEEPIDENTITY,
> TABLOCK
> );');
>
> It gave the following error. thanks
> XML Validation: Declaration not found for element
> 'http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactRecord:ContactRecord'.
> Location: /*:AdditionalContactInfo[1]/*:ContactRecord[1]
>
>

>
>> If you look at the installation script for AdventureWorks (instawdb.sql),
>> you'll find a series of BULK INSERT statements that load all the .csv
>> files
>> for the database. Here's the statement for the Person.Contact table. I
>> simply modified the statement to point to the location of the .csv file
>> on
>> my server.
>>
>> EXECUTE (N'BULK INSERT [Person].[Contact]
>> FROM ''C:\Program Files\Microsoft SQL
>> Server\90\Tools\Samples\AdventureWorks
>> OLTP\Contact.csv''
>> WITH (
>> CHECK_CONSTRAINTS,
>> CODEPAGE=''ACP'',
>> DATAFILETYPE=''widechar'',
>> FIELDTERMINATOR=''+|'',
>> ROWTERMINATOR=''&|\n'',
>> KEEPIDENTITY,
>> TABLOCK
>> );');
>>
>> However, unless you know for sure that the Person.Contact table is the
>> only
>> empty table, you may want to recreate the entire database by running the
>> installation script. The instructions for doing this are in Books Online
>> in
>> the topic "Reinstalling Sample Databases From Scripts".
>>
>> --
>> Gail Erickson [MS]
>> SQL Server Documentation Team
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights
>>


>> >I have the AdventureWorks database in sql server 2005.
>> > The Table Person.Contact is empty. I have the .csv file for the data
>> > for
>> > this table. This .csv seems to be xml data.
>> > How can I get this particular .csv into this table?
>> > I basically would like to somehow populate this particular table.
>> > Thanks
>>
>>
>>