Oracle-SQL Server Conversion And Stored Procedures

Feb 15, 2000

Hello Everyone,
First problem :
I have an application which uses Power Builder and Oracle and my job is to convert it so that it can run on a SQL server database.
Oracle allows empty strings - '' - to mean NULL. If the application inserts an empty string in a column of a table, Oracle takes it to mean NULL.
How can i have this functionality in SQL Server?

Second Problem:
SQL Server does not allow stored procedures like sp_addlogin and sp_droplogin etc., to be executed from within a transaction. So everytime i need to execute these stored procedures thru my application, i disconnect and set autocommit to true and connect again. after executing these stored procedures, i disconnect again , set autocommit to false and then connect again. is this how it should be done or is there some better way of doing it.

All help will be highly appreciated. I really need help on these problems - fast.
Thanks

View 2 Replies


ADVERTISEMENT

Oracle Stored Procedures VERSUS SQL Server Stored Procedures

Jul 23, 2005

I want to know the differences between SQL Server 2000 storedprocedures and oracle stored procedures? Do they have differentsyntax? The concept should be the same that the stored proceduresexecute in the database server with better performance?Please advise good references for Oracle stored procedures also.thanks!!

View 11 Replies View Related

Transact SQL :: Find All Stored Procedures That Reference Oracle Table Name Within Server OPENQUERY Statement

Aug 10, 2015

One of our Oracle Tables changed and I am wondering if there's any way that I can query all of our Stored Procedures to try and find out if that Oracle Table Name is referenced in any of our SQL Server Stored Procedures OPENQUERY statements?

View 2 Replies View Related

Oracle Stored Procedures

Feb 26, 2004

Is there a way to call an Oracle stored procedure through a MS SQL stored procedure (via linked server)? If so, can output parameters be used?

View 1 Replies View Related

Regarding Stored Procedures In Oracle(On 8th)

Mar 8, 2008



Hi all,
I wrote following SP in Oracle but getting Red color with Into symbol at Procedure Name in List of Procs.

create or replace procedure EXAMPLE(:year in char, TYPE in char) AS
BEGIN
IF :year IS NULL THEN
select s.survey_year,st.survey_type_name,count(s.survey_id) as count from tqdb_survey s,TQDB_SURVEYS_TYPE st where s.survey_type_id=st.SURVEY_TYPE_ID
and st.survey_type_name=TYPE and s.is_active='N' and s.survey_year>0 group by s.SURVEY_YEAR,st.survey_type_name;
ELSE IF TYPE IS NULL THEN
select s.survey_year,st.survey_type_name,count(s.survey_id) as count from tqdb_survey s,TQDB_SURVEYS_TYPE st where s.survey_type_id=st.SURVEY_TYPE_ID
and s.survey_year=:year and s.is_active='N' and s.survey_year>0 group by s.SURVEY_YEAR,
st.survey_type_name;
END IF;
END EXAMPLE

Any Body Help me.

View 3 Replies View Related

Migrating SQL Stored Procedures To ORACLE 8.0

Jun 2, 2000

How do i migrate Stored Procedures from SQL Server (7.0) to ORACLE (8.0)??


Thanks
Anand

View 1 Replies View Related

How To Run Oracle Stored Procedures, Especially With REF CURSOR

May 16, 2008

Hello,
Does SQL server 2005 provide capability to run Oracle stored procedures. I already have a linked server established for Oracle.

I have several oracle stored procedures that :

a) Accept multiple input parameters and return multiple out parameters.

b) Accept multiple input parameters and return a REF CURSOR as out parameter.

If you have any sample code, can you please post it here along with any suggestions. I researched, but there seems to be no solution, especially for REF CURSOR. Much appreciate it.
Thnx
Sam

View 20 Replies View Related

Oracle 8 Conversion To MS SQL Server 7

May 9, 2001

I am in the process of trying to create a mirror image of our Oracle database in SQL Server. I have all of the code that was used to create Stored Procedures on the Oracle side. I am having a lot of trouble trying to figure out what the corresponding syntax to create these procedures in SQL Server would be. Has anybody been able to locate any sources of information that would help me or had any experience with this problem? I would appreciate any help anyone can give me.

Specifically I am looking for help on the following items:

Oracle Sql Server
RETURN NUMBER ?
IS ?
BEGIN ?
SELECT FROM DUAL ?
EXCEPTION HANDLING ?

Here's some of what I have so far:
Oracle SQL Server
CREATE OR REPLACE PROCEDURE CREATE PROC AS
Variable_name @variable_name
number numeric
dual #temptable

Thanks!

View 2 Replies View Related

Oracle To SQL Server SQL Conversion

May 18, 2005

Hi,

I've got a couple of snippets of code that I am not sure how to convert. Any thoughts?

Thanks,

Steve

====================================

Select
to_char(AM_VEST_YEAR0, 'FM999,999,999,999,990') ||'|'||
to_char(AM_VEST_YEAR1, 'FM999,999,999,999,990') ||'|'||
to_char(AM_VEST_YEAR2, 'FM999,999,999,999,990') ||'|'||
to_char(AM_VEST_YEAR3, 'FM999,999,999,999,990') ||'|'||
to_char(AM_VEST_YEAR4, 'FM999,999,999,999,990') ||'|'||
to_char(AM_VEST_YEAR5, 'FM999,999,999,999,990') as data_row


=====================================

from
VEST_SCHED,
(select to_date('31-DEC-'||to_char(to_number(to_char(sysdate, 'yyyy'))+1), 'dd-mon-yyyy') as max_date
from dual) b,
(select to_date('1-JAN-'||to_char(to_number(to_char(sysdate, 'yyyy'))+1), 'dd-mon-yyyy') as min_date
from dual) c
where
OPTS_CANC < '1' and
VEST_DT BETWEEN c.min_date AND b.max_date and
emplid = '[CURRENT_EMPLID]'
group by
emplid, GRANT_NUM

View 1 Replies View Related

Conversion Sql From Oracle To SQL Server

Nov 9, 2004

Hi Guys, I have this statement that I am converting from Oracle to SQL. Help pls:-) PP_PRICEPOINT_ID is a decimal. What is the appropriate usage..

Oracle
-------------
update pricepoint set pp_type = decode(substr(pp_pricepoint_id,1,1),7,0,2),
pp_qtybreakindex =substr(pp_pricepoint_id,3,1) where pp_type is null and pp_qtybreakIndex is null;

Here is its SQL
-----------------
UPDATE pricepoint
SETpp_type =
CASE SUBSTRING(pp_pricepoint_id, 1, 1)
WHEN 7 THEN 0
ELSE 2
END,
pp_qtybreakindex = SUBSTRING(pp_pricepoint_id, 3, 1)
WHERE pp_type is null
ANDpp_qtybreakIndex is null
----------------
I am getting the error
The data type decimal is invalid for the substring function. Allowed types are: char/varchar, nchar/nvarchar, and binary/varbinary.

View 3 Replies View Related

Oracle To Sql Server Conversion

Jan 31, 2006

Something went a bit wrong. Converted Oracle 10g to Sql Server 2000.
Now, in the schema there is a column that allows nulls.
In Oracle if you look at the column, you see NULL.
However if I look at the same created in Sql Server it actually does not have a <NULL> value there.
When the conversion was done however, all of these NULLs from Oracle came across into Sql Server with the actual value of <NULL>.
This causes the problem that these objects are now no longer displayed within my application. They show up fine using Oracle, and if I use Sql Server from the start it is fine -- the column is just blank, not acutally NULL. I can force the <NULL> value by doing the ctrl+0 on the field, and that breaks it as well.

The column has to allow nulls, but the actual value cannot be <NULL> (in Sql Server). Any suggestions on getting rid of the NULL - I could do an update, but it actually just has to be blank rather than having a value. I tried an update to set it to ' ' but that didn't really work - here was my statement:
update [table] set [columnname] = '' where [columnname] = '<NULL>'

Any other suggestions besides try again? But if it has to be 'try the conversion again' then that's the answer.
Thanks much

View 1 Replies View Related

Conversion Of Query From Oracle To SQL Server

Sep 12, 2007

Hi Friends,
Need ur help desperately. I am stuck with one of the queries which i had written in Oracle and need the same in SQL Server.Please have a look at the following query :

select * from r_tin_1099_info where instr(translate( nm_ctrl_cd , '~!@#$%^&*()_+}{":?><`-=]['''';/., ', '*******************************' ),'*') > 0;

Basically my purpose is to replace the values in column NM_CTRL_CD having wild card characters with '*' and then select this rows to display.

However i am not able to run the same query in SQL Server since TRANSLATE is not a built in func. I have tried a lot to replace it but could only one func : REPLACE . But the same will not replace any one of the above wild characters but will replace the entire pattern.Please note that it should be able replace even if one of the wild card characters are present in the string and not necessarily the entire pattern shown above.

please reply ASAP since i am working and need this query to fix a defect.


Thanks in advance.

View 9 Replies View Related

Oracle To Sql Server Date Conversion

Mar 12, 2008

Hi Gurus,
I need to convert this statement to sql server.
SELECT to_date('24-08-2007 13:11:12','dd-mm-yyyy hh24:mi:ss'),to_date('24-aug-2007 13:11:12','dd-mon-yyyy hh24:mi:ss') from dual

can anyone help please.

View 1 Replies View Related

Oracle Ltrim With 2 Arguments Conversion In SQL Server

Mar 1, 2004

How do I convert Oracle's LTRIM(char, set) to SQL Server?

Thanks,
Jake

View 8 Replies View Related

Executing (from Sql Server 2000) Procedures From Oracle Package Through Linkserver

Feb 16, 2004

Hello,

I deaply need to know how to execute procedures from package in oracle, from sqlserver 2000 using linkserver.

Thank you very much,
Victor
DBA

View 2 Replies View Related

Oracle Conversion

Dec 21, 2000

I have been working with SQLServer since 1996, and now our company is being forced to consider a switch to Oracle. Does anyone know of a good Oracle/SQL Server comparison or an Oracle discussion board where I can find out the Oracle half of the equation to make a case for switching or not?

Thanks.

View 3 Replies View Related

Conversion Of Oracle Version 0-1 From DEC Machine

Jul 20, 2005

Hi... Have a customer who's running version 1 of oracle on a DECmachine.. is there a driver out there for that stuff? How might oneget the data from the DEC machine to Sql Server 2000???? All I havenow are fdl/sfl files.thanks in advance.Steve

View 2 Replies View Related

Unicode Conversion Error Oracle-SSIS

Jan 31, 2008

I am using SSIS to extract data from one oracle server to another. When i use this SSIS package in another Server, it gives me Unicode conversion error to non unicode for some Columns which are VARCHAR2 type. I have to then used drived column and use conversion, but my question is why this error from i migrate my SSIS package to another server.

View 1 Replies View Related

Oracle To SQLServer Conversion For SELECT TO_CHAR(SYSDATE,'DDMMYYYYHHMMSS')

Nov 6, 2004

Hi,

i am trying to convert the following oracle sql,

SELECT TO_CHAR(SYSDATE,'DDMMYYYYHHMMSS')
(oraclequery)
into a MSSQLServer sql query.

Could you help me to get the equivalent of the above query in sqlserver.

PS: i tried using the following query, but i cannot get the month equivalent as 01/02/03/04 instead i get january/febrauary/march, etc

SELECT
(DATENAME(d, GETDATE())+
DATENAME(m, GETDATE())+
DATENAME(yyyy, GETDATE())+
DATENAME(hh, GETDATE())+
DATENAME(mi, GETDATE())+
DATENAME(ss, GETDATE()))
AS "Month Name"
(ms sqlserver)
The above query gives output as "6November2004174837"

what i need as result is "06112004174837"

Thanks,
Gopi.
Follow your DREAMS...

View 3 Replies View Related

Stored Procedures 2005 Vs Stored Procedures 2000

Sep 30, 2006

Hi,



This Might be a really simple thing, however we have just installed SQL server 2005 on a new server, and are having difficulties with the set up of the Store Procedures. Every time we try to modify an existing stored procedure it attempts to save it as an SQL file, unlike in 2000 where it saved it as part of the database itself.



Thank you in advance for any help on this matter



View 1 Replies View Related

Using Oracle Procedures In SSIS

Apr 25, 2007

Hi Everyone



Please pardon my inexperience, I am new to SSIS. I am having some difficulty with using Oracle

procedures in SSIS. I have installed and configured the Oracle Client Software for 10g. I have managed to

create a connection to the Oracle database that I will be using. I am currently using the Oracle Provider For

OLE DB. I want to add an OLE DB Source component to the Data Flow which I then want to configure to

use an Oracle procedure to bring back the data that I need.



When I want to execute the Oracle Proc in the same way that I would normally execute a SQL Proc it returns

an error saying:



TITLE: Microsoft Visual Studio
------------------------------

Error at Data Flow Task [OLE DB Source [1]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4A.
An OLE DB record is available. Source: "OraOLEDB" Hresult: 0x80040E4A Description: "Command was not prepared.".

Error at Data Flow Task [OLE DB Source [1]]: Unable to retrieve column information from the data source. Make sure your target table in the database is available.



------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC020204A (Microsoft.SqlServer.DTSPipelineWrap)



I have tried using a ADO.NET connection and then using a Data Reader Source component but I get an

error with my SQL Statement saying "Invalid SQL Command"



Could anyone please provide me with some information on what I am doing wrong? Or possibly point me to

information that will help me? I have been searching the net non-stop without success.






View 15 Replies View Related

How To Migrate Sql Server Stored Proc Into Oracle

Apr 20, 2008

hi
pls can any one help me out in how to migrate sql server stored procedures into oracle plsql procedures .

View 1 Replies View Related

Call A Oracle Stored Proc In SQL SERVER

Jul 20, 2005

We have set up Oracle database as a linked server in SQL Server.We are able to access Oracle tables fine.I am trying to call a Oracle stored procedure in SQL Server as follows:declare @p1 varchar(1000)set @p1 = 'HHH'exec GENRET..OPS$GENRET.BOB_TEST_PROC @p1This is the message:Server 'GENRET' is not configured for RPC.Please help.Thanks in advancev

View 1 Replies View Related

SQL Server Stored Procedures/VB.Net

Mar 24, 2004

IS there a way inside code for vb.net to programmatically change sorting in a stored procedure???Reason is I need a two way sort and did not want to have to write a SP for each way ....If so Do you have an example.....

View 3 Replies View Related

Stored Procedures In Sql Server 6.5

Jan 4, 2000

Hi,

Everytime after I restore any database on the sql server 6.5, I have to recompile all the stored procedures in that database.Is there any method to overcome this problem?


Thanks,
Manu.

View 1 Replies View Related

ADO And SQL Server Stored Procedures

Apr 19, 1999

Trying to run a SQL Server 6.5 stored procedure via ADO 2.0 in Visual Basic 6. The stored procedure moves roughly 10000 records from one table to another within the same database. The procedure works just fine when run from a SQL editor such as I/SQL, but only transfers a few hundred records when it is executed from a VB application using ADO 2.0.
The guilty code can be seen below. Any thoughts?

Public cnSQL As New ADODB.Connection
Public qry As New ADODB.Command

With cnSQL
.ConnectionString = ConnectStringSQL
.ConnectionTimeout = 20
.Open
End With

Set qry.ActiveConnection = cnSQL
qry.CommandType = adCmdStoredProc
qry.CommandTimeout = 120

qry.CommandText = "sp_VGInsertBOMStructure"
qry.Execute

Peter

View 1 Replies View Related

ADO SQL/Server Stored Procedures

Jun 6, 2002

I have a stored procedure on SQL/Server 2000 that inserts into a #temptable. When I execute it from Query Analyzer it works fine.
When I execute it from an ASP using ADO it gives me an Open Error message. When I comment out the
#temptable the ASP works fine. Can someone shed some light on this? Do I have to do an ADO opent on the
#temptable?

View 4 Replies View Related

SQL SERVER Stored Procedures

Apr 11, 2006

Is there any application which can tell you the procedure called within a procedure.

View 2 Replies View Related

Stored Procedures In SQL Server

May 16, 2008

I come from a MySQL background, and have recently began migrating to SQL Server.

I can't, for the life of me, find an example of a stored procedure that does the following in SQL Server:
- Multi-lined
- Contains both input and output parameters
- Sets one of the output parameters within the stored procedure

Can anyone provide some insight? I.e. Why does the following not work?

IF NOT EXISTS (SELECT * FROM syscomments WHERE id = object_id('usp_test'))
BEGIN
CREATE PROCEDURE "usp_test"
(@num1 INT, @num2 INT, @result INT OUTPUT)
AS
BEGIN
DECLARE newValue INT;
SET @newValue = num1 + num2;
SET @result = @newValue;
END;
END;

I get these errors (I'm using the Management Studio Express)

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'PROCEDURE'.
Msg 155, Level 15, State 2, Line 7
'INT' is not a recognized CURSOR option.
Msg 137, Level 15, State 1, Line 8
Must declare the scalar variable "@newValue".
Msg 137, Level 15, State 2, Line 9
Must declare the scalar variable "@newValue".

View 8 Replies View Related

Connect To Oracle Stored Procedure From SQL Server Stored Procedure...and Vice Versa.

Sep 19, 2006

I have a requirement to execute an Oracle procedure from within an SQL Server procedure and vice versa.

How do I do that? Articles, code samples, etc???

View 1 Replies View Related

How Do You Execute An Oracle Stored Procedure From A SQL Server DTS Package?

Jul 23, 2005

I've tried several different way to execute a oracle storedprocedure from a DTS package but to no avail.I have a Linked Server setup which does bring back Oracle tables from theserver when I click on the Tables icon.Here's my DTS statement:exec omsd..OMS_TECO.SP_Callback_Update_Pkg(116);omsd is the linked serveroms_teco is the owner of the oracle stored procedureSP_Callback_Update_Pkg is the oracle stored procedure(116) is the parameter passed to the oracle stored procedureI put the above exec statement in a DTS Execute SQL Task using a Connectionthat I tried using several OLE and ODBC Data Sources. I can't seem to findthe right combination.Please Help!!!!!!!!--Message posted via http://www.sqlmonster.com

View 1 Replies View Related

Creating Stored Procedures In Sql Server

Jul 2, 2007

I just installed sql server 2005 on my machine.  I've been using Access for some time and have created my stored procedures easily in it.  However, this sql server 2005 is so complicated.  In Access, all I had to do was "Create a New Query", write my sql statement, name and save it.   However, I am having so much trouble with this sql server.  For example, when I create a stored procedure in sql server, it has a .sql extension.  I am assuming the stored procedure is a file.  However, after saving it, I expand my database, expand programmability, and expand stored procedures, yet my new stored procedure is not there.  It's placed in a file called projects.  I need to access this stored procedure from code, but in visual studio, I get an error message, "Cannot find stored procedure sp_Roster".  Here is the code I used to access my stored procedure from vb.net.  I thought it would work but it didntDim comm As New SqlCommandDim strsql As StringDim strconn As String        strsql = "sp_Roster"        strconn = "server=Home; user=sa; pwd=juwar74; database=Book;"        With comm            .Connection = New SqlConnection(strconn)            .CommandText = strsql            .CommandType = CommandType.StoredProcedure            With .Parameters.Add("TeacherID", SqlDbType.Char)                .Value = "DawsMark@aol.com"            End With            With .Parameters.Add("ClassID", SqlDbType.Int)                .Value = CInt(classid)            End With            With .Parameters.Add("sID", SqlDbType.Int)                .Value = ssID            End With            With .Parameters.Add("sLastName", SqlDbType.Char)                .Value = lastname            End With            With .Parameters.Add("sFirstName", SqlDbType.Char)                .Value = firstname            End With            With .Parameters.Add("sMiddleName", SqlDbType.Char)                .Value = middlename            End With            With .Parameters.Add("Student", SqlDbType.Char)                .Value = fullname            End With            With .Parameters.Add("Password", SqlDbType.Char)                .Value = password            End With            .Connection.Open()            .ExecuteNonQuery()            With comm.Connection                If .State = ConnectionState.Open Then                    .Close()                End If            End With        End With Here is my procedure that I created and that was saved as sp_Roster.sql in sql server CREATE PROCEDURE sp_Roster     ASBEGIN       SET NOCOUNT ON;    -- Insert statements for procedure here    INSERT INTO Roster (TeacherID, ClassID, sID, sLastName, sFirstName, sMiddleName, Student, Password) VALUES (@TeacherID, @ClassID, @sID, @sLastName, @sFirstName, @sMiddleName, @Student, @Password)ENDGO Why isn't ado.net finding it in sql server.  Is the sqlstr correct?  

View 2 Replies View Related

Sql Server Stored Procedures, Just One Thing After Another

Jul 2, 2007

 In a previous post, someone helped me with creating stored procedures, and I am grateful because I am transitioning from the Access World.
Anyway, I get an error at .ExecuteNonQuery in visual studio 2005 when I run the following code: 
Dim strsql As String        Dim strconn As String        strsql = "sp_Roster"        strconn = "server=xxxx; user=xxxx; pwd=xxxx; database=xxxx;"        With comm            .Connection = New SqlConnection(strconn)            .CommandText = strsql            .CommandType = CommandType.StoredProcedure            With .Parameters.Add("TeacherID", SqlDbType.Char)                .Value = "DawsMark@aol.com"            End With            With .Parameters.Add("ClassID", SqlDbType.Int)                .Value = classid            End With            With .Parameters.Add("sID", SqlDbType.Int)                .Value = ssID            End With            With .Parameters.Add("sLastName", SqlDbType.Char)                .Value = lastname            End With            With .Parameters.Add("sFirstName", SqlDbType.Char)                .Value = firstname            End With            With .Parameters.Add("sMiddleName", SqlDbType.Char)                .Value = middlename            End With            With .Parameters.Add("Student", SqlDbType.Char)                .Value = fullname            End With            With .Parameters.Add("Password", SqlDbType.Char)                .Value = password            End With            .Connection.Open()            .ExecuteNonQuery()            With comm.Connection                If .State = ConnectionState.Open Then                    .Close()                End If            End With        End With
The error was:  Error converting data type char to int.
The stored procedure in sql server was as follows 
CREATE PROCEDURE sp_Roster     -- Add the parameters for the stored procedure here@TeacherID varchar(50),@ClassID  int,@sID int,@sLastName varchar(50),@sFirstName varchar(50),@sMiddleName varchar(50),@Student varchar(50),@Password varchar(50)ASBEGIN    -- SET NOCOUNT ON added to prevent extra result sets from    -- interfering with SELECT statements.    SET NOCOUNT ON;    -- Insert statements for procedure here    INSERT INTO Roster (TeacherID, ClassID, sID, sLastName, sFirstName, sMiddleName, Student, Password) VALUES (@TeacherID, @ClassID, @sID, @sLastName, @sFirstName, @sMiddleName, @Student, @Password)ENDGO
The error also says "sqlexception was unhandled by user code.
This is strange because this code worked perfectly when connecting to Access and when I used oledb. 
So how is it the code's problem?  Is the stored procedure causing the error or the code.  Can someone please help. thanks. 
<Edited by Dinakar Nethi>
Please mask your useird/pwd info in the connection string when posting to a public forum like this
</Edit>

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved