Showing posts with label input. Show all posts
Showing posts with label input. Show all posts

Wednesday, March 28, 2012

Problems with sql-statement / making rows to columns...

I have the following problem:

I'd like to display these rows as columns via an sql-statement:

Input

Code Snippet

4 10000000 Juice
4 10000000 Coca-Cola
4 10000000 Orange
4 10000000 Walmart

Output

Code Snippet

4 10000000 Juice Coca-Cola Orange Walmart

To get the data within the input table, I momentarily use this select:

Code Snippet

SELECT artikel.lfdnr,

artikel.artnr1,

arteinordnung.einordnung

FROM artikel

LEFT JOIN aeinord ON artikel.lfdnr = aeinord.artnr

LEFT JOIN arteinordnung ON aeinord.kriterium = arteinordnung.kriterium

AND aeinord.einordnung = arteinordnung.lfdnr

ORDER BY artikel.lfdnr

Any suggestions on how to modify this statement to get the data into the output-format?

Any help's appreciated!

here you go..

Code Snippet

Create Table #data (

[Col1] int ,

[Col2] int ,

[Col3] varchar(20)

);

Insert Into #data Values('4','10000000','Juice');

Insert Into #data Values('4','10000000','Coca-Cola');

Insert Into #data Values('4','10000000','Orange');

Insert Into #data Values('4','10000000','Walmart');

Insert Into #data Values('5','10000000','Juice');

Insert Into #data Values('5','10000000','Coca-Cola');

Insert Into #data Values('5','10000000','Orange');

--For SQL Server 2005

;With CTE

as

(

Select Col1,Col2,Col3,Row_Number() Over (Partition By Col1,Col2 Order By Col1,Col2) Rowid From #Data

)

Select * From CTE

Pivot

(

Max(Col3) For Rowid in ([1],[2],[3],[4],[5]) --,...[n])

) as Pvt

/*

--If your intention is concatinate all the row data in one column

;With CTE

as

(

Select Col1,Col2,Col3,Row_Number() Over (Partition By Col1,Col2 Order By Col1,Col2) Rowid From #Data

)

, Result

as

(

Select * From CTE

Pivot

(

Max(Col3) For Rowid in ([1],[2],[3],[4],[5])--,...[n])

) as Pvt

)

Select

Col1

, Col2

, Isnull([1] +';','') + Isnull([2] +';','') + Isnull([3] +';','') + Isnull([4] +';','') + Isnull([5] +';','') as OneColumn

From

Result

*/

--For SQL Server 2000

Select * into #Temp From #Data

Alter table #Temp Add RowId Int Identity(1,1)

Alter table #Temp Add GroupedRowId int

Update #Temp

Set GroupedRowId = RowId - (Select Min(RowId)-1 From #Temp Sub Where Sub.Col1 = #Temp.Col1 And Sub.Col2 = #Temp.Col2)

Select

Col1,

Col2,

Max(Case When GroupedRowId=1 Then Col3 End),

Max(Case When GroupedRowId=2 Then Col3 End),

Max(Case When GroupedRowId=3 Then Col3 End),

Max(Case When GroupedRowId=4 Then Col3 End),

Max(Case When GroupedRowId=5 Then Col3 End)

-- ... ,Max(Case When GroupedRowId=n Then Col3 End)

From

#Temp

Group By

Col1,Col2

/*

--If your intention is concatinate all the row data in one column

Select

Col1,

Col2,

Isnull([1] +';','') + Isnull([2] +';','') + Isnull([3] +';','') + Isnull([4] +';','') + Isnull([5] +';','') as OneColumn

From

(

Select

Col1,

Col2,

Max(Case When GroupedRowId=1 Then Col3 End) [1],

Max(Case When GroupedRowId=2 Then Col3 End) [2],

Max(Case When GroupedRowId=3 Then Col3 End) [3],

Max(Case When GroupedRowId=4 Then Col3 End) [4],

Max(Case When GroupedRowId=5 Then Col3 End) [5]

-- ... ,Max(Case When GroupedRowId=n Then Col3 End)

From

#Temp

Group By

Col1,Col2

) as Result

*/

Drop Table #Temp

|||

Manivannan.D.Sekaran wrote:

here you go..

Thanks, that was a huge post

I fully understand your solution, but I have the problem that Juice, Coca-Cola,Orange and Walmart aren't the only possible values. There can be 1...n values within those row...

So, I need a solution that can extract dynamically those values without doing this manually:

Insert Into #data Values('4','10000000','Juice');

Insert Into #data Values('4','10000000','Coca-Cola');

Insert Into #data Values('4','10000000','Orange');

Insert Into #data Values('4','10000000','Walmart');

Insert Into #data Values('5','10000000','Juice');

Insert Into #data Values('5','10000000','Coca-Cola');

Insert Into #data Values('5','10000000','Orange');


Any suggestions?!
|||

It appears that Mani created a sample table, and loaded it with sample data so he could try to work out a solution for you. (Since you didn't bother to offer DDL or sample data.)

It would appear that perhaps you didn't really 'fully understand' Manivannan's suggested solution -since you didn't follow the creation and poputation of the sample data...

I think that the solution that follows the loading of the sample data could most likely be altered to fit your table structure -whatever that may be...

(It does look like he went the 'extra step'...)

|||

your select statement is write

for output:

you can format it inside the program

like that

duppose you put the artikel.lfdnr in x1 and artikel.artnr1 in x2 and arteinordnung.einordnung in x3

s= "4 10000000 "

if (x1=4 and x2= 10000000)

S=S+x3

|||

Ok, so instead of the creation process via "CREATE table #data" I'd let run my standard SQL SELECT. Then I've got all the possible values within the output table. Then I encounter this problem:

Code Snippet

;With CTE

as

(

Select Col1,Col2,Col3,Row_Number() Over (Partition By Col1,Col2 Order By Col1,Col2) Rowid From #Data

)

Select * From CTE

Pivot

(

Max(Col3) For Rowid in ([1],[2],[3],[4],[5]) --,...[n])

) as Pvt

It looks like I need to know all the possible values for this part, or am I wrong:

Code Snippet

Max(Col3) For Rowid in ([1],[2],[3],[4],[5]) --,...[n])

|||

Code Snippet

create function dbo.MultiList ( @.col1 as int, @.col2 as int )

returns varchar(8000)

as

begin

declare @.list varchar(8000)

select @.list = coalesce( @.list + ', ', '') + Col3

from data where Col1 = @.col1 and Col2 = @.col2

return @.list

end

GO

Create Table data (

[Col1] int ,

[Col2] int ,

[Col3] varchar(20)

);

Insert Into data Values('4','10000000','Juice');

Insert Into data Values('4','10000000','Coca-Cola');

Insert Into data Values('4','10000000','Orange');

Insert Into data Values('4','10000000','Walmart');

Insert Into data Values('5','10000000','Juice');

Insert Into data Values('5','10000000','Coca-Cola');

Insert Into data Values('5','10000000','Orange');

select col1, col2, dbo.MultiList(col1, col2) as items

from data

group by col1, col2

|||

Mh, maybe you're right. I am really struggling in setting up the correct SQL-statement...

At the moment I don't see the possibility to adapt the pivot-function to my SQL-statement.

|||

Rather than the CTE, you may be better served by examining the 'MultiList' function that DaleJ offered.

|||

The multilist function is completely new to me. How do I approach it at best?

To understand the functionality better I'd like to execute my standard SELECT, then I got all the relevant data within a table. Is it possible to skip this procedure in your multilist function, or do I need to set it up like that?

Code Snippet

Create Table data (

[Col1] int ,

[Col2] int ,

[Col3] varchar(20)

);

Somehow I feel not comfortable with the "INSERT INTO ... VALUES (..., ..., ...)" command. It implies that I have to add once all possible list-entries, am I wrong?

|||

Somehow I feel not comfortable with the "INSERT INTO ... VALUES (..., ..., ...)" command. It implies that I have to add once all possible list-entries, am I wrong?

Yes, you are wrong about that. In the previous posting, a sample table was created and it was populated with sample data. You DO NOT USE THE SAMPLE DATA -you use your own table and column names, following the example.

Create the MultiList function in your database, and then execute your 'standard SELECT' -carefully following the example.

|||

I think the way I'd like to format the data is a bit off... I just took a look at the raw data, and it appears to me that the problem isn't as complicated as I thought.

Table1 has a Parent-Child-hierarchy structure... Table2 connects Table1 and the Article_Table via the 'ArtNr'.

Code Snippet

Table1:

LfdNr Kriterium Einordnung

0 1 Marke

0 2 Markenhauptgruppe

0 3 Markenuntergruppe

1 1 Eigenmarke

2 1 Fremdmarke

2 2 Frische

2 3 Valensina

3 2 Handelsmarke

3 3 Chiquita

4 2 Paradise

4 3 Rio Doro

5 2 Lizenzmarke

5 3 Hitchcock

...

Code Snippet

Table2:

ArtNr LfdNr Kriterium

4711 2 1

4711 3 2

4711 4 3

5000 1 1

5000 2 2

...

The Output table should look like this:

Code Snippet

Desired Output:

ArtNr Marke Markenhauptgruppe Markenuntergruppe

4711 Fremdmarke Handelsmarke Rio Doro

5000 Eigenmarke Frische

|||

here it is, (replace the #table1 & #tabl2 with your orginal table name on the Sql Server 2000 & 2005 query)

Code Snippet

Create Table #table1 (

[LfdNr] int ,

[Kriterium] int ,

[Einordnung] Varchar(100)

);

Insert Into #table1 Values('0','1','Marke');

Insert Into #table1 Values('0','2','Markenhauptgruppe');

Insert Into #table1 Values('0','3','Markenuntergruppe');

Insert Into #table1 Values('1','1','Eigenmarke');

Insert Into #table1 Values('2','1','Fremdmarke');

Insert Into #table1 Values('2','2','Frische');

Insert Into #table1 Values('2','3','Valensina');

Insert Into #table1 Values('3','2','Handelsmarke');

Insert Into #table1 Values('3','3','Chiquita');

Insert Into #table1 Values('4','2','Paradise');

Insert Into #table1 Values('4','3','Rio Doro');

Insert Into #table1 Values('5','2','Lizenzmarke');

Insert Into #table1 Values('5','3','Hitchcock');

Create Table #table2 (

[ArtNr] Varchar(100) ,

[LfdNr] int ,

[Kriterium] int

);

Insert Into #table2 Values('4711','2','1');

Insert Into #table2 Values('4711','3','2');

Insert Into #table2 Values('4711','4','3');

Insert Into #table2 Values('5000','1','1');

Insert Into #table2 Values('5000','2','2');

Code Snippet

--SQL Server 2000

Select

[ArtNr]

,[Einordnung]

into #Temp

from

#table2 A

Join #table1 B on

A.[LfdNr]=B.[LfdNr]

And A.[Kriterium] = B.[Kriterium]

Order By

1,2

Alter table #Temp Add RowId int identity(1,1), GroupId int

Update #Temp

Set

GroupId = RowId - (Select Min(RowId) -1 From #Temp Sub Where Sub.[ArtNr] = #Temp.[ArtNr])

select

[ArtNr]

,Isnull(Max(Case When GroupId = 1 Then [Einordnung] End),'') as [Marke]

,Isnull(Max(Case When GroupId = 2 Then [Einordnung] End),'') as [Markenhauptgruppe]

,Isnull(Max(Case When GroupId = 3 Then [Einordnung] End),'') as [Markenuntergruppe]

from

#temp

Group By

[ArtNr]

Code Snippet

--SQL Server 2005

;With CTE

as

(

Select

[ArtNr]

,[Einordnung]

,Row_Number() Over (Partition By [ArtNr] Order By [ArtNr]) GroupId

from

#table2 A

Join #table1 B on

A.[LfdNr]=B.[LfdNr]

And A.[Kriterium] = B.[Kriterium]

)

Select

[ArtNr]

,Isnull([1] ,'') as [Marke]

,Isnull([2] ,'') as [Markenhauptgruppe]

,Isnull([3] ,'') as [Markenuntergruppe]

from

CTE

Pivot

(

Max([Einordnung]) For GroupId in ([1],[2],[3])

) Pvt

|||

Awesome, this is it! Many thanks! But I've got another problem:

(SSMS marks the '(' near PVT as Error?)

Meldung 102, Ebene 15, Status 1, Zeile 21

Falsche Syntax in der N?he von '('.

in english: ;-)

Message 102, Level 15, Status 1, Row 21

False Syntax near '('.

I don't know exactly what's wrong with the statement, to me it seems fine...

|||anyone?

Friday, March 23, 2012

Problems with remote SQL 2005 server and excel as an input source

Hello,

I am trying to write my first couple Integration Services packages using SQL 2005. My configuration is a workstation running windows xp professional, and a windows 2003 server that is running the SQL server.

Anytime I run a package that accesses the remote server from my workstation, the job fails with an error code. The workstation cannot seem to run a package to load data to the remote sql server. Why is this? Is there a service pack, or hotfix coming out soon to correct this problem?

Additionally, I also seem to be unable to update a database using excel as the data source from which information should be used. If I import my excel spreadsheet into an access table, I can update the sql database from Access using integration services. Why can't I use an excel spreadsheet as the source? Is there a a service pack or hotfix coming out soon for 2005 sql that will correct this problem?

Thanks!

Jim

I've been able to input an excel spreadsheet in the dataflow and then use an Oracle destination to update an oracle table - what errors are you getting?|||

Jim R wrote:

Is there a a service pack or hotfix coming out soon for 2005 sql that will correct this problem?

It would help if you told us what the problem was before anyone answers that question.

What errors are you getting?

|||What destination transform are you using?

If you are using the SQL Server Destination, then the package must run

on the destination server. The SQL Destination inserts data much

more efficiently than the OLE Destination.

If you are using the OLE DB Destination, then please post the error message you are receiving so that we help you debug.

Larry|||

I am using an SQL destination, but I don't understand why the package must run on the destination server for SQL server? That was never a requirement before with sql 2000's DTS services... Shouldn't I be able to develop, test, and even deploy packages to other servers?

Speaking of deploying. Once I have a package developed, how can I run it on the server machine? I don't intend to install the visual studio, etc. on the server....

Jim

|||

Jim,

the SQL Server desination is a special destination adapter for LOCAL SQL Servers only... If you want to connect to remote servers you have to use the OLE DB destination... This is by design...

|||

Why is the SQL server destination for LOCAL SQL servers only? Isn't there a significant performance increase in using the SQL server type versus the OLEDB one when accessing a SQL server?

I also read some articles that state that the SSIS service does not get installed in the workstation edition of SQL server 2005, unless you use the Developer Edition. Can someone also explain why that is?

Thanks!

|||

Hi,

to be honest: no idea. I only know that they did some "tricks" to make accessing local servers faster...

What do you mean with "workstation edition"? I'm not aware of this edition...

|||

The Service is indeed not part of Workgroup Edition, as noted in the matrix in "Features Supported by the Editions of SQL Server 2005." However unlike the SQL Server or Analysis Services services, for example, the Integration Services service is not crucial to building and running packages, but merely provides some extra services, like monitoring running packages.

-Doug

|||

Even i have taken excel spreadsheet as input in dataflow and use SQL server destination to update data. But iam not able to update data in database.

I have an excel source which has some columns with values(for ex column with values "yes" / "No"). Now i need to update particular column of a table in a sql server database depending on the column value in excel source.

There was no error in the package but i could not get the expected result could any one help me in this regard.

thanks in advance.

|||

You have not told us what unexpected results you obtained, or what errors you encountered.

You almost certainly need to add a Derived Column transformation to convert "yes" or "no" values to the appropriate Boolean values that a SQL database is probably expecting.

For relatively simple import and export scenarios, you'll usually save yourself some grief by using the Import and Export Wizard to create and save the initial package, then revise and enhance it as needed.

-Doug

|||

Jim R wrote:

Why is the SQL server destination for LOCAL SQL servers only?

Because of the way it works. It has a special mechanism for accessing the memory space of the SQL Server instance but of course in order to do that it needs to be on the same machine. It isn't a limitation that they have delierately put in - its just the way it is.

-Jamie

|||

The scenario goes on like this:

I have an excel source with 3 coulumns(sno,sname,status). The values for status column will be either "yes" or "no".

I have a student table in SQL Server datatase which contain some columns(stdsno,stdsname, stdstatus)

i need to update the stdstatus column of student table in sql server database if and only if the sno of excel source matches with stdsno of sqlserver table and also status column value of excel source is "no".

(for example i need to update the stdstatus column values in database only if the status column value of excel source is "no").

I have taken excel as input source and sqlserverdestination as destination. Which transformation should i use to achive the above said

output.

|||

sanj_vam wrote:

The scenario goes on like this:

I have an excel source with 3 coulumns(sno,sname,status). The values for status column will be either "yes" or "no".

I have a student table in SQL Server datatase which contain some columns(stdsno,stdsname, stdstatus)

i need to update the stdstatus column of student table in sql server database if and only if the sno of excel source matches with stdsno of sqlserver table and also status column value of excel source is "no".

(for example i need to update the stdstatus column values in database only if the status column value of excel source is "no").

I have taken excel as input source and sqlserverdestination as destination. Which transformation should i use to achive the above said

output.

If you need to compare source with destination then Lookup is a good option. Merge Join also has cpabilities in this area.

-Jamie

Problems with remote SQL 2005 server and excel as an input source

Hello,

I am trying to write my first couple Integration Services packages using SQL 2005. My configuration is a workstation running windows xp professional, and a windows 2003 server that is running the SQL server.

Anytime I run a package that accesses the remote server from my workstation, the job fails with an error code. The workstation cannot seem to run a package to load data to the remote sql server. Why is this? Is there a service pack, or hotfix coming out soon to correct this problem?

Additionally, I also seem to be unable to update a database using excel as the data source from which information should be used. If I import my excel spreadsheet into an access table, I can update the sql database from Access using integration services. Why can't I use an excel spreadsheet as the source? Is there a a service pack or hotfix coming out soon for 2005 sql that will correct this problem?

Thanks!

Jim

I've been able to input an excel spreadsheet in the dataflow and then use an Oracle destination to update an oracle table - what errors are you getting?|||

Jim R wrote:

Is there a a service pack or hotfix coming out soon for 2005 sql that will correct this problem?

It would help if you told us what the problem was before anyone answers that question.

What errors are you getting?

|||What destination transform are you using?

If you are using the SQL Server Destination, then the package must run

on the destination server. The SQL Destination inserts data much

more efficiently than the OLE Destination.

If you are using the OLE DB Destination, then please post the error message you are receiving so that we help you debug.

Larry|||

I am using an SQL destination, but I don't understand why the package must run on the destination server for SQL server? That was never a requirement before with sql 2000's DTS services... Shouldn't I be able to develop, test, and even deploy packages to other servers?

Speaking of deploying. Once I have a package developed, how can I run it on the server machine? I don't intend to install the visual studio, etc. on the server....

Jim

|||

Jim,

the SQL Server desination is a special destination adapter for LOCAL SQL Servers only... If you want to connect to remote servers you have to use the OLE DB destination... This is by design...

|||

Why is the SQL server destination for LOCAL SQL servers only? Isn't there a significant performance increase in using the SQL server type versus the OLEDB one when accessing a SQL server?

I also read some articles that state that the SSIS service does not get installed in the workstation edition of SQL server 2005, unless you use the Developer Edition. Can someone also explain why that is?

Thanks!

|||

Hi,

to be honest: no idea. I only know that they did some "tricks" to make accessing local servers faster...

What do you mean with "workstation edition"? I'm not aware of this edition...

|||

The Service is indeed not part of Workgroup Edition, as noted in the matrix in "Features Supported by the Editions of SQL Server 2005." However unlike the SQL Server or Analysis Services services, for example, the Integration Services service is not crucial to building and running packages, but merely provides some extra services, like monitoring running packages.

-Doug

|||

Even i have taken excel spreadsheet as input in dataflow and use SQL server destination to update data. But iam not able to update data in database.

I have an excel source which has some columns with values(for ex column with values "yes" / "No"). Now i need to update particular column of a table in a sql server database depending on the column value in excel source.

There was no error in the package but i could not get the expected result could any one help me in this regard.

thanks in advance.

|||

You have not told us what unexpected results you obtained, or what errors you encountered.

You almost certainly need to add a Derived Column transformation to convert "yes" or "no" values to the appropriate Boolean values that a SQL database is probably expecting.

For relatively simple import and export scenarios, you'll usually save yourself some grief by using the Import and Export Wizard to create and save the initial package, then revise and enhance it as needed.

-Doug

|||

Jim R wrote:

Why is the SQL server destination for LOCAL SQL servers only?

Because of the way it works. It has a special mechanism for accessing the memory space of the SQL Server instance but of course in order to do that it needs to be on the same machine. It isn't a limitation that they have delierately put in - its just the way it is.

-Jamie

|||

The scenario goes on like this:

I have an excel source with 3 coulumns(sno,sname,status). The values for status column will be either "yes" or "no".

I have a student table in SQL Server datatase which contain some columns(stdsno,stdsname, stdstatus)

i need to update the stdstatus column of student table in sql server database if and only if the sno of excel source matches with stdsno of sqlserver table and also status column value of excel source is "no".

(for example i need to update the stdstatus column values in database only if the status column value of excel source is "no").

I have taken excel as input source and sqlserverdestination as destination. Which transformation should i use to achive the above said

output.

|||

sanj_vam wrote:

The scenario goes on like this:

I have an excel source with 3 coulumns(sno,sname,status). The values for status column will be either "yes" or "no".

I have a student table in SQL Server datatase which contain some columns(stdsno,stdsname, stdstatus)

i need to update the stdstatus column of student table in sql server database if and only if the sno of excel source matches with stdsno of sqlserver table and also status column value of excel source is "no".

(for example i need to update the stdstatus column values in database only if the status column value of excel source is "no").

I have taken excel as input source and sqlserverdestination as destination. Which transformation should i use to achive the above said

output.

If you need to compare source with destination then Lookup is a good option. Merge Join also has cpabilities in this area.

-Jamie

Wednesday, March 21, 2012

Problems with Parameterized insert SQL with OLEDB Destination

Hello,

I've searched around and can't find any references to the problem I'm having. I'd appreciate any ideas or input.

I'm trying to use the OLEDB Destination for an insert at the end of a long data flow. I need to parameterize the input, and for some of the columns I need to use literal values instead of parameters. It seems like this should be the most common thing in the world, but I'm at a loss to get it to work.

I type in the SQL statement just like I would with an OLEDB Command transformation, with the ? character for the appropriate columns in the VALUES clause. However, when I try to use Parse Query I get this error:

"Parameter Information cannot be derived from SQL statements. Set parameter information before preparing command."

OK, so I start searching around for ways to set the parameter information. Nada. On the Mappings tab the parameter list is empty. I check MSDN and it says this:

"If you have entered a parameterized query by using ? as a parameter placeholder in the query text, use the Set Query Parameters dialog box to map query input parameters to package variables."

Set Query Parameters dialog box? I don't see this anywhere. What am I missing?

The options with the SQL Server Destination seem even more limited, as I don't see any way to use a SQL statement or stored procedure.

For the moment I'm going to stub this off with an OLEDB Command transformation with a downstream Trash desintation, but hopefully that's only going to be temporary.

Thanks,
Dan

Update: I tried using a stored procedure instead of a parameterized SQL statement, and this does not work either--though with different error info:

"Invalid parameter number"

If anyone has any idea what's going on here, I could really use the help. Is there a known bug with the OLE-DB Destination not being to handle parameterized SQL statements or stored procedure calls? Does anyone know about this mysterious "Set Query Parameters" dialog box?

Thanks,
Dan

|||You have got the wrong end of the stick with the OLE-DB destination. The SQL Command option allows you to target "results of an SQL statement", that is not the same as a parameterised command. Result set means a SELECT. To target a comand such as UPDATE or DELETE you need to use the OLE-DB Command as you did previously. The Command Tx does not require any subsequent transformations, so no need for the Trash destination.|||Thank you for your post, Darren. I appreciate your taking the time.

Knowing that OLE-DB Command transform does not require a downstream destination helps me a lot. Somewhere I had picked up the idea that all paths through the data flow needed to terminate in a destination.

That said, I still say something is very strange in all this. Here is a description of the OLE-DB Destination from MSDN/BOL:

"The OLE DB destination loads data into a variety of OLE DB-compliant databases using a database table or view or an SQL command."

Sounds about right to me. So I'm at a loss to resolve that idea with the statement in the same article, to which you referred, that the SQL option is for "The results of an SQL statement." Huh? How does calling a SELECT statement coincide with the idea of "loading date into a variety of OLE-DB compliant databases?"

This gets even more confusing: If you click through to the "OLE DB Destination Editor (Connection Manager Page)" article from the main article, you can find this explanation that the SQL command is to "Load data into the OLE DB destination by using a SQL query."

Then another contradiction comes in: the Build Query button in the OLE-DB Destination editor defaults to building a SELECT statement.

My point in all this is not to prove you wrong or anything, Darren, but rather to submit that I think we have a combination design and documentation bug here: somewhere along the line the SQL capabilities of the OLE-DB Destination got confused with the data-selecting functionality of the OLE-DB Source. Or am I missing something?

Thanks again,
Dan

|||

I certainly think the docs are not very clear. I think I know what it does, and what the capabilities of the SQL option is, but may be wrong. I have a habit of not reading Books Online when I (think I) know what it does already. I couldn't find anything particuarly strong in support of my description other than that snippet. Hopefully sombody else will give their opinion on this, but either way you should submit some documentation feedback using the link on the page.

If you are right in your expection of how it works, then feedback that the documention is not detailed enough to allow you to get it working properly. If I am right then feedback that the docs gave you the wrong impression. All these references to the docs mean Doug will be along in a minute to clarify for us! Sure he will still appreciate the feedback being logged.

|||Well, I started to post the feedback to the MSDN page, but when I tried to hit the Enter key to make a line break in my message it submitted it prematurely, and after that the feedback form was gone. Oh, well. Hopefully someone reading this thread will be able to use this information.

That said, setting aside the documentation issues, what do you think of this concept of a SQL SELECT statement with a Destination? Assuming this is not a bug, what would be the purpose for this functionality?

My theory is that this is something akin to a copy-and-paste bug, in which a feature from the OLE-DB Source was reused in the Destination. But I'm ready and willing to be wrong.

Dan

|||

I always do my feedback from within my local copy of Books Online. After the rating option this just opens an email, much easier.

You can insert data into a table. You can insert data into a view. A view is just a SELECT statement, so my take is the OLE-DB provider adds some additional functionality that pseudo materializes the SELECT. After all it just needs the meta-data and it can get this from a select as well as a table. The data is then processed into the base table. There is probably more information in the depths of the OLE-DB specifications, but I have always found life is too short for those. Why not just try it and run a profiler trace at the same time. Compare the underlying statements issued by the different methods will give you a clearer understanding of the differences, as well as the similarities.

Problems with Oracle character setting

Hi there,

I am using an ADO Oracle Connector to store Oracle data to an SQL Server.
When I map the input data to the OLEDB destination I get the Error msg that
unicode (DT_WSTR) cannot be mapped to 1292 character code (DT_STR).

To solve this I put a Data Conversion Transformation between Source and Destination.
That would mean a lot of work if I couldn't map the data directly from Source to Destination
for all the tables of my project.

I checked the NLS-Settings from the Oracle db:
select * from sys.v_$nls_parameters
NLS_CHARACTERSET -> WE8ISO8859P1

It's really a mystery to me why the DataReader converts Latin-1 to unicode which has to be
converted to Latin-1 again.
Could someone please help me out?

Fridtjof
The problem here is with managed code. The CLR doesn't have a ANSI type string so all strings are converted to Unicode. So in actuality, it is not the datareader that does the conversion but Oracle's ADO.NET connector. Obviously, knowing this doesn't really help you out all that much though. Is there any way you can make the SQL Server table be unicode instead of ANSI. If not then data conversion is the only solution other than to get an OLEDB driver for Oracle, since OLEDB does support ANSI directly.

HTH,
Matt|||Matt,

you're right. I've tried to download Oracle data via OLEDB which nags that it cannot read Oracle's character setting and assumes it to be 1292 (or was it 1252?). But it downloads the data correctly.

Unfortunately I cannot set the password property in a Package configuration. See this post:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=161564&SiteID=1

This way I'm not getting much further. One have to ponder between the different restrictions :(
Thanks anyway
Fridtjof

Monday, March 12, 2012

Problems with input columns for mining models

Hi, all experts here,

Thank you very much for your kind attention.

I got a strange problem with SQL Server 2005 data mining models though. I have selected the input columns for my mining model (which are different from the input columns for its mining structure, since I ignored some of the columns for the selected model). But the mining model still used all input columns from the mining structure rather than those I chose for the mining model.

Would please any one here give me any guidance and advices for that. Really need help for that.

Thanks a lot in advance for any help.

With best regards,

Yours sincerely,

Are the remaining columns marked as Ignore in the designer, and yet used in the model? Is it possible that the model was not re-deployed? Or the viewer was not refreshed?|||

Hi, bogdan, thank you very much for your advices. Yes, I have marked those remaining columns as ignored and the whole mining structure and the mining models are redeployed and processed. I really find it strange as this problem did not occur before when I processed the mining models in this way. Really need help and further guidance for that.

Thanks a lot.

With best regards,

Yours sincerely,

|||

Hi, Bogdan thank you very much, have got it done. But as the same way though, but it is working now.

Thank you very much.

With best regards,

Yours sincerely,

|||You can use this tip http://www.sqlserverdatamining.com/DMCommunity/TipsNTricks/3652.aspx to inspect the structure and models to ensure that they are as you expect them to be.|||

Hi, Jamie, thank you very much for your advanced guidance. That's very helpful in a way.

With best regards,

Yours sincerely,