Showing posts with label generated. Show all posts
Showing posts with label generated. Show all posts

Wednesday, March 28, 2012

Importing text file problem using Import and Export Wizard

Hi,

I'm trying to import text file (generated by UNIX - collation ISO LATIN 2) into the database using SQL SERVER 2005 Import and Export Wizard. I have got a problem with importing a decimal number, because in that column are not only decimal numbers (that's OK), but there are also spaces (not null, the column is filled by spaces and it looks like | |). When I'm trying import that file, then will occur the problem of truncation and import stops.

I can import that data by BULK INSERT, but I would like to import it by Import and Export Wizard at once without using subsequent conversions.

I *think* you'll have to do this in two steps. One to load that field as a varchar field. Two to convert that data (excluding spaces) to decimals.|||You could use the package generated by the import/export wizard, and the edit it with BIDS to add the logic necessary to convert/replace those column before the insertion...

Monday, March 12, 2012

Importing DB from Another Install

I have a MS SQL database generated from another user and
sent to me via email. I am trying to import it into my
install of SQL Server 2000. The two approaches I have
tried have not worked, but maybe I am missing a trick.
1) Set up tables with the query analyzer and use the
import wizard under All Tasks >> Import. Even after
registering the datasource for import in ODBC Datasources
control panel, the db for import does not appear in the
list of datasources for import with this wizard.
2) Create a new blank database and copy the datafile for
import to the directory indicated as the location of the
blank database datafile. When I do this the database is
greyed out in Enterprise Manager and marked 'suspect'. No
tables are viewable under the database after copying.
I've also tried this approach after setting up the table
structure with the Query Analyzer.Jennifer,
Short answer: search the SQL Server 2000 Books Online for the section
"Attaching and Detaching a Database"
Longer answer ... and assuming that you have Enterprise Manager and that
your user has sent you **both** the data (.mdf) and log (.ldf) files:
In EM: right-click the "Databases" folder: All Tasks | Attach Database
Chief Tenaya
"Jennifer Sanders" <anonymous@.discussions.microsoft.com> wrote in message
news:e7d601c41022$fe75ec10$a601280a@.phx.gbl...
> I have a MS SQL database generated from another user and
> sent to me via email. I am trying to import it into my
> install of SQL Server 2000. The two approaches I have
> tried have not worked, but maybe I am missing a trick.
> 1) Set up tables with the query analyzer and use the
> import wizard under All Tasks >> Import. Even after
> registering the datasource for import in ODBC Datasources
> control panel, the db for import does not appear in the
> list of datasources for import with this wizard.
> 2) Create a new blank database and copy the datafile for
> import to the directory indicated as the location of the
> blank database datafile. When I do this the database is
> greyed out in Enterprise Manager and marked 'suspect'. No
> tables are viewable under the database after copying.
> I've also tried this approach after setting up the table
> structure with the Query Analyzer.|||I found out it's a backup file.
>--Original Message--
>Jennifer,
>Short answer: search the SQL Server 2000 Books Online for
the section
>"Attaching and Detaching a Database"
>Longer answer ... and assuming that you have Enterprise
Manager and that
>your user has sent you **both** the data (.mdf) and log
(.ldf) files:
>In EM: right-click the "Databases" folder: All Tasks |
Attach Database
>Chief Tenaya
>
>"Jennifer Sanders" <anonymous@.discussions.microsoft.com>
wrote in message
>news:e7d601c41022$fe75ec10$a601280a@.phx.gbl...
Datasources
No
>
>.
>

Friday, February 24, 2012

Importing binary data tables?

My apologies in advance for hitting the forum with such a basic question...

I've got a large number of raw binary data tables generated by some external software that I'd like to import into a SQL database. I've set up the database tables to hold the information and assigned the table columns the appropriate data types, but I can't figure out how to import the data.

From what I can see there isn't a data import 'wizard' that supports raw binary, and my limited experience with bcp has given me the impression that it only supports ASCII tables. I find it hard to believe that there isn't a DTS procedure to handle this... but I'm definitely stuck...

Thanks,
-fpsivYou can import data by using bcp or bulk insert to text or image fields and then parse data if it needs.|||Thanks for the quick reply snail...

I was working with BULK INSERT via the Query Analyzer... but ran into a brick wall in trying to set up the format file. I can't seem to get the 'column collation' parameter set correctly. I thought that 'collation' applied to character data... is there a correct collation for raw binary?

Thanks,
-fpsiv|||Check this : import image, I was trying to the same for binary file - it works too.

http://www.dbforums.com/t926676.html|||Thanks snail... got it working! I really appreciate your help!

Cheers
-fpsiv|||hmmml ! I tried the same query but it didn't worked :

CREATE TABLE Pictures
(
Pic_id smallint
IDENTITY(1,1)
PRIMARY KEY CLUSTERED,
Images nvarchar(5000)
)

BULK INSERT Northwind.dbo.[pictures] FROM 'c:\bridge.jpg'
WITH (
FORMATFILE = 'c:\bcp.fmt'
)

------------
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'from'.

Did I missing something?

Thanks