dbTalk Databases Forums  

create columns from rows

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss create columns from rows in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Adie
 
Posts: n/a

Default create columns from rows - 02-09-2004 , 07:03 AM






Hi, I have bunch of data from an excel spreadsheet that needs
transforming from a row into the column names for a db, can I do this
with DTS.


Also, how can I tell DTS not to import row data with null values?

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: create columns from rows - 02-09-2004 , 07:26 AM






Can you show us a sample of the data you have and what you exapect it to
look like along with the CREATE TABLE statements.

Skipping rows based on values of you data could be done as simply as

SELECT..........
FROM Table
WHERE col IS NOT NULL

if all the column values are NULL then you could do

SELECT..........
FROM Table
WHERE COALESCE(col list) IS NOT NULL


<col list> are the columns you do not want to be null.

Short of that you can use an Active Script transform and the return value
(DTSTransformStatus)

mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%2 0Server\80\Tools\Books\dts
prog.chm::/dtspconst_3h6b.htm







--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Adie" <arsehinge (AT) h-o-t-m-a-i-l (DOT) com> wrote

Quote:
Hi, I have bunch of data from an excel spreadsheet that needs
transforming from a row into the column names for a db, can I do this
with DTS.


Also, how can I tell DTS not to import row data with null values?



Reply With Quote
  #3  
Old   
Adie
 
Posts: n/a

Default Re: create columns from rows - 02-10-2004 , 03:35 PM



Allan Mitchell wrote:

Quote:
Can you show us a sample of the data you have and what you exapect it to
look like along with the CREATE TABLE statements.

Skipping rows based on values of you data could be done as simply as

SELECT..........
FROM Table
WHERE col IS NOT NULL

if all the column values are NULL then you could do

SELECT..........
FROM Table
WHERE COALESCE(col list) IS NOT NULL


col list> are the columns you do not want to be null.

Short of that you can use an Active Script transform and the return value
(DTSTransformStatus)

mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%2 0Server\80\Tools\Books\dts
prog.chm::/dtspconst_3h6b.htm
It's ok, I sorted the file out with code rather than use sql server,
DTS seems a bit temperamental if youre not entirely sure of what youre
doing.

Seems that excel can also produce ",,,,,,,," in a csv file where the
contenrts of cells have been deleted, hence the nulls.

Thanks anyway.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.