Showing posts with label translate. Show all posts
Showing posts with label translate. Show all posts

Friday, March 30, 2012

How to translate varchar into varbinary?

Hi everyone,

We're trying to migrate a varchar field from Sql2k to varbinary in a sql25k through a dtsx package. We get an error which tell us: "data will be lost".

Does anyone have any idea about that?

Thanks for your time and inputs,

Do it in the extract query, T-SQL supports explicit casts between those two types

DECLARE @.v varchar(10)

SET @.v = '0123456789'

SELECT CAST(@.v AS varbinary(10))

Wednesday, March 28, 2012

How to translate oracle decode

Hi,

How to translate oracle Decode without changed code I mean:

I have one application and instead to change all decode to case when I would like just replace decode for dbo.decode, so I

Wrote this function

select dbo.fnDecode( 1 , 2 , 3 )

first parameter always int, and the others parameters could be char, int or float.

I would like to test first value and return second or third value

-> sql_variant for all parameters, ok

but I can use + or -

I can't do this

select dbo.fnDecode( 1 , 2 , 3 ) + dbo.fnDecode( 1 , 2 , 3 )

If I put cast ok, but I is there another way, overload this call?

With clr doesn't work, because Sql Server doesn't accept function overload calls from C#

Any ideia?

cheers,

Any ideia?

Use explicit cast/convert for both operands?

|||There is no easy way to do what you are trying i.e., replacing Oracle's built-in DECODE function with TSQL/SQLCLR equivalent. The sql_variant approach will work to some extent but you will run into issues when you try to use operators on the value as you experienced. It will require explicit CASTING in lot of cases. And using TSQL UDF will introduce performance problems especially in DMLs if used incorrectly. SQLCLR approach doesn't work because we don't support overloaded methods. Best is to convert uses of DECODE to CASE expression. Note that CASE expression is actually ANSI SQL standard and more portable way to write SQL code. In fact, Oracle supports it from 7.3 or 8i so there is no reason to use DECODE in Oracle too. As stop gap measure, you could write different set of TSQL UDFs (decode, decode1, decode2 etc) each handling different data types. And when you hit performance problems with your queries/DML that uses these UDFs you can convert to CASE expression i.e., inline the code.|||I can't use cast/convert, because I never know what kind of value will be, so I dont know what kind of cast if to char or to int,float ....

How to translate net_address

Does anyone know who to translate the column net_address
from master..sysprocess into it's corresponding ip address?
Thanks,
David.The net_address is the mac address of the machine
It corresponds to the Physical address returned from ipconfig /all
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Is there a way to find the host, from the net_address? How?
>--Original Message--
>The net_address is the mac address of the machine
>It corresponds to the Physical address returned from
ipconfig /all
>Rand
>This posting is provided "as is" with no warranties and
confers no rights.
>.
>|||Not that I am aware of. There is no correlation between the mac address and
the ip address.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||You can correlate the IP address back from hostname
select spid, dbo.fn_getIPaddress(hostname) as IPaddress
from sysprocesses
where spid > 50
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2004 All rights reserved.
"David Velasco" <anonymous@.discussions.microsoft.com> wrote in message
news:f02701c40c61$7cb7ae30$a301280a@.phx.gbl...
> Does anyone know who to translate the column net_address
> from master..sysprocess into it's corresponding ip address?
> Thanks,
> David.sql

How to translate into SSIS?

Hi everyone,

My current dutie is translate Vb code into SSIS. The following structure is getting me totally crazy:

sql = "SELECT * FROM TABLE1 WHERE FIELD = XXXX"

rs.execute sql

WHILE NOT RS.EOF

STUFF

ANOTHER SELECT AND ANOTHER LOOP

...

...

INSERT AND DELETE STUFF

END WHILE

Which is the best method in order to reach this goal? I'm trying to by means of OLEDB Source Editor connected to Script Component Task on data flow layer but I'm stuck with this.

I don't want to do cursors or something like that with T-SQL.

Thanks in advance for your inputs/help and regards,

Could you use nested FOREACH containers? Store your initial resultset in a variable, then iterate through that, executing the second SQL statement, storing the results in a variable, and using a second FOREACH to iterate that.|||

hi,

using ForEach Loop container on control flow, you mean?

should I use ForEach ADO enumerator, shouldn't?

tia

|||Yes, control flow. Yes, ADO recordset.|||Thank you. I'll test it|||

It's easier than I though. I'll use a Script Task on Control Flow task. Just that task,

I don't need nothing else

|||Could you share the script? Stripped of anything specific to your business, of course.

How to translate into SSIS?

Hi everyone,

My current dutie is translate Vb code into SSIS. The following structure is getting me totally crazy:

sql = "SELECT * FROM TABLE1 WHERE FIELD = XXXX"

rs.execute sql

WHILE NOT RS.EOF

STUFF

ANOTHER SELECT AND ANOTHER LOOP

...

...

INSERT AND DELETE STUFF

END WHILE

Which is the best method in order to reach this goal? I'm trying to by means of OLEDB Source Editor connected to Script Component Task on data flow layer but I'm stuck with this.

I don't want to do cursors or something like that with T-SQL.

Thanks in advance for your inputs/help and regards,

Could you use nested FOREACH containers? Store your initial resultset in a variable, then iterate through that, executing the second SQL statement, storing the results in a variable, and using a second FOREACH to iterate that.|||

hi,

using ForEach Loop container on control flow, you mean?

should I use ForEach ADO enumerator, shouldn't?

tia

|||Yes, control flow. Yes, ADO recordset.|||Thank you. I'll test it|||

It's easier than I though. I'll use a Script Task on Control Flow task. Just that task,

I don't need nothing else

|||Could you share the script? Stripped of anything specific to your business, of course.

How to translate DTSStepScriptResult_DontExecuteTask into SSIS?

Hi everyone,

We're struggling ourselves with this and we are stuck.

Which is the equivalent for a SSIS in a Script Task component on CONTROL FLOW layer?

Main = DTSStepScriptResult_ExecuteTask

Thanks for your input and regards,

Set the script result to a variable and then use that variable in a precedence constraint on the Execute XXX Task.|||

To try and expand on Phil's reply. The constant you mention does not exist, because you no longer have workflow scripts as you did in DTS. What you do have is a much richer set of precedence constraint functionality. As well as having the normal succes and failure stype stuff, you can also set an expression on the constraint. The expression uses a new syntax, which is quite simple, but maybe you could replace your script logic with an expression. Your logic may be too complicated for this, so you would have to use an Script Task and from that your result in variable. The variable can easily be referenced in an expressionon the constraint.

I would avoid any ActiveX Script in SSIS, use the new features, including the Script Task if required. The support for ActiveX is not good, things like error information are very poor now.

How to Translate an Oracle DataBase to SQL Server DataBase with constraints and

Hello,

Mr. rnealejr:
I use MS SQL Server 2000.
Also, I have a problem with SQL Server.
I have about 50 tables and views in an Oracle DataBase and I have tried to translate them to SQL Server DataBases.
They were translated succefully but there was two problems :
1- Key constraints were not translated? (i.e. the destination SQL Server database became without primary key and foreign key constraints and aother constraints)
2- Also, views are translated into tables not into view ??

Could you slove these problems?

After I get more information I will be able to serve your good forum with good posts becuase until now I am student

Thank you very much

ShihabMaybe you can 'reverse engineer' the Oracle database with a data modelling tool (e.g. ERwin) and then 'forward engineer' that schema to SQL Server.
I don't know whether views also can go through this trajectory, but since the syntax of creating views is the same (although SQL Server 2000 doesn't do the create or replace trick) you can build these views from the statements you can see within the Oracle Enterprise Manager or TOAD. Save the creation statements of both the tables, constraints and views in a script. You'll always need it at least once.

Edwin|||Originally posted by edwin
Maybe you can 'reverse engineer' the Oracle database with a data modelling tool (e.g. ERwin) and then 'forward engineer' that schema to SQL Server.
I don't know whether views also can go through this trajectory, but since the syntax of creating views is the same (although SQL Server 2000 doesn't do the create or replace trick) you can build these views from the statements you can see within the Oracle Enterprise Manager or TOAD. Save the creation statements of both the tables, constraints and views in a script. You'll always need it at least once.

Edwin

I am very sorry, I don't understand what you mean by 'reverse engineer' and 'forward engineer'
Could you clearify these terms ??
Thank you very much|||"reverse engineer" "forward engineer" (http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=%22reverse+engineer%22++%22forward+engineer%22)

rudy
http://rudy.ca/