Showing posts with label columns. Show all posts
Showing posts with label columns. Show all posts

Tuesday, March 27, 2012

DTS question - need your help!

I am trying to use DTS load Excel data to SQL Server

The Excel Spreadsheet has 100 columns in each row. Let say I have 3 rows in Excel sheet.
Each row has 100 columns as follows,

column1, column2, ...column100

Now I want to load it to a table which has only one column.

The first record will be the column1 of the first row from the excel spreadsheet
The second record will be the column2 of the first row from the excel spreadsheet
...
The 100th record will be the column100 of the first row from the excel spreadsheet

The 101th record will be the column1 of the second row from the excel spreadsheet
...

Can anyone give me a suggections? Thanks in advance,

PeterHmm, any way you can transpose the columns in Excel? I can't think of a simple way to create an SQL Statement to transpose the columns in DTS. It might be easier to manipulate Excel, rather than trying to do the transpose in DTS.|||I agree with the first post, but you could do it starting with DTS. Suck the excel sheet into a 'holding' table and then run a stored procedure that takes each cell and makes it a record by itself. You could use a cursor to step through the records and do 100 inserts to the final table for each row in the holding table.|||Is the order truyly that important?

You can get all the data in one column by using the following SQL statement instead of a table as your source:

SELECT Column1
FROM [Sheet1$]
UNION ALL
SELECT Column2
FROM [Sheet1$]
UNION ALL
SELECT Column3
FROM [Sheet1$]
...

You'll need a lot of cut and past (or a handy little script) to generate all the UNIONed selects.

If the order truly is important, then I'd add another column to your spreadsheet for the row number. Import the entire spreadsheet into the a temp table using something like this:

SELECT TheValue = Column1,
TheRow = RowNumber, -- your row number column
TheColumn = 1
FROM [Sheet1$]
UNION ALL
...

Increment the column number for each column. Again, a script will write this monster select for you. Then you can insert into your final table:

INSERT ...
SELECT TheValue
FROM MyTempImportTable
ORDER by TheRow ASC, TheColumn ASC

FYI - You may need to use UNION rather than UNION ALL. I don't recall the exact workings of EXCEL with respect to the ALL part. A little experimenting (or a syntax) error should clear it up pretty quickly.

Sunday, March 25, 2012

DTS Problem

I am going to import 2 columns (out of ten) from a CSV to
a database in SQL Server 2000.
I would like how can I choose these 2 columns ? In DTS
Import / Export Wizard, I click the Transform button.
Should I change the source columns to "Ignore" for those I
don't want to import OR change the destination ones ?
Besides, for the table I am importing data, there is a
column that is non-nullable that may cause problem when I
import the columns. Is there any suggestion how to fix
it ?
Thanks
.You will have to ignore those columns, by selecting ignore from the combo
box - you are right.
Or simply, you could write a query that selects only the required columns,
and use that as your source, instead of a table.
If your target column in non-nullable and if you think your source has
NULLs, then you could use a COALESCE or ISNULL function in your source query
to replace those NULLs with something suitable.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2dcd901c46a34$f76520a0$a301280a@.phx
.gbl...
I am going to import 2 columns (out of ten) from a CSV to
a database in SQL Server 2000.
I would like how can I choose these 2 columns ? In DTS
Import / Export Wizard, I click the Transform button.
Should I change the source columns to "Ignore" for those I
don't want to import OR change the destination ones ?
Besides, for the table I am importing data, there is a
column that is non-nullable that may cause problem when I
import the columns. Is there any suggestion how to fix
it ?
Thanks
.|||Thank you for your advice.
I would like to know should I select "Ignore" in Source
Columns only?
The table is already full and I just have to import data
to 2 columns only (1 is the key).
Actually the column causes problem is not my target column
(A column I don't import anything but it is only a non-
nullable field only) and I should not update the
production data.
Thanking you in anticipation.

>--Original Message--
>You will have to ignore those columns, by selecting
ignore from the combo
>box - you are right.
>Or simply, you could write a query that selects only the
required columns,
>and use that as your source, instead of a table.
>If your target column in non-nullable and if you think
your source has
>NULLs, then you could use a COALESCE or ISNULL function
in your source query
>to replace those NULLs with something suitable.
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>"Peter" <anonymous@.discussions.microsoft.com> wrote in
message
> news:2dcd901c46a34$f76520a0$a301280a@.phx
.gbl...
>I am going to import 2 columns (out of ten) from a CSV to
>a database in SQL Server 2000.
>I would like how can I choose these 2 columns ? In DTS
>Import / Export Wizard, I click the Transform button.
>Should I change the source columns to "Ignore" for those I
>don't want to import OR change the destination ones ?
>Besides, for the table I am importing data, there is a
>column that is non-nullable that may cause problem when I
>import the columns. Is there any suggestion how to fix
>it ?
>Thanks
>
>..
>
>.
>

DTS Problem

I am going to import 2 columns (out of ten) from a CSV to
a database in SQL Server 2000.
I would like how can I choose these 2 columns ? In DTS
Import / Export Wizard, I click the Transform button.
Should I change the source columns to "Ignore" for those I
don't want to import OR change the destination ones ?
Besides, for the table I am importing data, there is a
column that is non-nullable that may cause problem when I
import the columns. Is there any suggestion how to fix
it ?
Thanks
..
You will have to ignore those columns, by selecting ignore from the combo
box - you are right.
Or simply, you could write a query that selects only the required columns,
and use that as your source, instead of a table.
If your target column in non-nullable and if you think your source has
NULLs, then you could use a COALESCE or ISNULL function in your source query
to replace those NULLs with something suitable.
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2dcd901c46a34$f76520a0$a301280a@.phx.gbl...
I am going to import 2 columns (out of ten) from a CSV to
a database in SQL Server 2000.
I would like how can I choose these 2 columns ? In DTS
Import / Export Wizard, I click the Transform button.
Should I change the source columns to "Ignore" for those I
don't want to import OR change the destination ones ?
Besides, for the table I am importing data, there is a
column that is non-nullable that may cause problem when I
import the columns. Is there any suggestion how to fix
it ?
Thanks
..
|||Thank you for your advice.
I would like to know should I select "Ignore" in Source
Columns only?
The table is already full and I just have to import data
to 2 columns only (1 is the key).
Actually the column causes problem is not my target column
(A column I don't import anything but it is only a non-
nullable field only) and I should not update the
production data.
Thanking you in anticipation.

>--Original Message--
>You will have to ignore those columns, by selecting
ignore from the combo
>box - you are right.
>Or simply, you could write a query that selects only the
required columns,
>and use that as your source, instead of a table.
>If your target column in non-nullable and if you think
your source has
>NULLs, then you could use a COALESCE or ISNULL function
in your source query
>to replace those NULLs with something suitable.
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>"Peter" <anonymous@.discussions.microsoft.com> wrote in
message
>news:2dcd901c46a34$f76520a0$a301280a@.phx.gbl...
>I am going to import 2 columns (out of ten) from a CSV to
>a database in SQL Server 2000.
>I would like how can I choose these 2 columns ? In DTS
>Import / Export Wizard, I click the Transform button.
>Should I change the source columns to "Ignore" for those I
>don't want to import OR change the destination ones ?
>Besides, for the table I am importing data, there is a
>column that is non-nullable that may cause problem when I
>import the columns. Is there any suggestion how to fix
>it ?
>Thanks
>
>..
>
>.
>

DTS Problem

I am going to import 2 columns (out of ten) from a CSV to
a database in SQL Server 2000.
I would like how can I choose these 2 columns ? In DTS
Import / Export Wizard, I click the Transform button.
Should I change the source columns to "Ignore" for those I
don't want to import OR change the destination ones ?
Besides, for the table I am importing data, there is a
column that is non-nullable that may cause problem when I
import the columns. Is there any suggestion how to fix
it ?
Thanks
.You will have to ignore those columns, by selecting ignore from the combo
box - you are right.
Or simply, you could write a query that selects only the required columns,
and use that as your source, instead of a table.
If your target column in non-nullable and if you think your source has
NULLs, then you could use a COALESCE or ISNULL function in your source query
to replace those NULLs with something suitable.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Peter" <anonymous@.discussions.microsoft.com> wrote in message
news:2dcd901c46a34$f76520a0$a301280a@.phx.gbl...
I am going to import 2 columns (out of ten) from a CSV to
a database in SQL Server 2000.
I would like how can I choose these 2 columns ? In DTS
Import / Export Wizard, I click the Transform button.
Should I change the source columns to "Ignore" for those I
don't want to import OR change the destination ones ?
Besides, for the table I am importing data, there is a
column that is non-nullable that may cause problem when I
import the columns. Is there any suggestion how to fix
it ?
Thanks
.|||Thank you for your advice.
I would like to know should I select "Ignore" in Source
Columns only?
The table is already full and I just have to import data
to 2 columns only (1 is the key).
Actually the column causes problem is not my target column
(A column I don't import anything but it is only a non-
nullable field only) and I should not update the
production data.
Thanking you in anticipation.
>--Original Message--
>You will have to ignore those columns, by selecting
ignore from the combo
>box - you are right.
>Or simply, you could write a query that selects only the
required columns,
>and use that as your source, instead of a table.
>If your target column in non-nullable and if you think
your source has
>NULLs, then you could use a COALESCE or ISNULL function
in your source query
>to replace those NULLs with something suitable.
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>"Peter" <anonymous@.discussions.microsoft.com> wrote in
message
>news:2dcd901c46a34$f76520a0$a301280a@.phx.gbl...
>I am going to import 2 columns (out of ten) from a CSV to
>a database in SQL Server 2000.
>I would like how can I choose these 2 columns ? In DTS
>Import / Export Wizard, I click the Transform button.
>Should I change the source columns to "Ignore" for those I
>don't want to import OR change the destination ones ?
>Besides, for the table I am importing data, there is a
>column that is non-nullable that may cause problem when I
>import the columns. Is there any suggestion how to fix
>it ?
>Thanks
>
>..
>
>.
>

Thursday, March 22, 2012

DTS performance

Hi,

Can anyone advise me of a quick way to estimate the time taken by DTS to
import a table (24 columns x 700,000 rows) from JD Edwards (running on
AS400) into SQL Server (new table and no manipulation involved)?

Many thanks,

Steve"Steve McDonald" <ajones1@.nsw.bigpond.net.au> wrote in message news:<TBbRa.7157$wU5.924@.news-server.bigpond.net.au>...
> Hi,
> Can anyone advise me of a quick way to estimate the time taken by DTS to
> import a table (24 columns x 700,000 rows) from JD Edwards (running on
> AS400) into SQL Server (new table and no manipulation involved)?
> Many thanks,
> Steve

There are plenty of factors which may vary from one environment to
another, so the most reliable way to find out would simply be to test
it. In theory, you could work out the volume of data (average row
length x number of rows), then divide that by your network speed, add
some time for DTS overhead etc., but in practice I think you wouldn't
get a very accurate answer.

Simon

Friday, February 17, 2012

dts import wizard

I want to import an excel spreadsheet 2000 into a sql server 2000 database.
When I import the columns from the excel spreadsheet, I am not always certai
n
what columns, and how many columns are included in each excel spreadsheet in
advance.
Thus is there a copy to automatically import all the columns from an excel
spreadsheet into a sql server 2000 database using the DTS import wizard? I
would like to be able to setup this copy metthod without having to declare
all the sql server 2000 columns in advance.
Thus, how would you do this?Hi
SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\MyExcel.xls";
User ID=Admin;Password=;Extended properties=Excel 8.0')...Book1$
"wendy elizabeth 26th" <wendyelizabeth26th@.discussions.microsoft.com> wrote
in message news:E8BA9079-FAD3-4726-BBB6-557E7C8DC32C@.microsoft.com...
>I want to import an excel spreadsheet 2000 into a sql server 2000 database.
> When I import the columns from the excel spreadsheet, I am not always
> certain
> what columns, and how many columns are included in each excel spreadsheet
> in
> advance.
> Thus is there a copy to automatically import all the columns from an
> excel
> spreadsheet into a sql server 2000 database using the DTS import wizard? I
> would like to be able to setup this copy metthod without having to declare
> all the sql server 2000 columns in advance.
> Thus, how would you do this?

Tuesday, February 14, 2012

DTS Help With Uploading An Excel Spreadsheet

Can somebody please tell me what I am doing wrong or need to do to resolve my issue. I having problems with one of the columns in an excel spreadsheet that I am trying to upload into the system. One of the columns contain values of both text and numbers such as 'ABC123', 'ABC124', '123456' etc. When I try uploading the sheet into SQL Server 2000 using DTS, the system removes all characters from the one column that I am having problems with. So entry 'ABC123' for example would be truncated to '123'. I tried formatting the column that I am having trouble with in excel to 'General' format as well as tried to transform the column to type varchar in SQL Server while using the DTS wizard but still had no luck. The problem is that SQL server thinks that the column is a float type column from the source and therefore truncates any characters.Well it seems that you are answering your own question.

The problem is that SQL server thinks that the column is a float type column from the source and therefore truncates any characters.

You will just need to play around with DTS and the import functionality of SQL to solve your issue. When you import into a new table using the import wizard be sure to go into the "transform" section and there you should be able to change the column type.

If this still fails trying creating the table structure first, this might force the spreadsheet data into the new column type.

Good luck,
Hope this helped|||I actually tried both steps and still cannot change the sources data type.