Oracle Ltrim With 2 Arguments Conversion In SQL Server
Mar 1, 2004How do I convert Oracle's LTRIM(char, set) to SQL Server?
Thanks,
Jake
How do I convert Oracle's LTRIM(char, set) to SQL Server?
Thanks,
Jake
I have an SqlDataSource control on my aspx page, this is connected to database by a built in procedure that returns a string dependent upon and ID passed in.
I have the followinbg codewhich is not complet, I woiuld appriciate any help to produce the correct code for the code file
Function GetCategoryName(ByVal ID As Integer) As String sdsCategoriesByID.SelectParameters("ID").Direction = Data.ParameterDirection.Input sdsCategoriesByID.SelectParameters.Item("ID").DefaultValue = 3 sdsCategoriesByID.Select() <<<< THIS LINE COMES UP WITH ERROR 1End Function
ERROR AS FOLLOWS
argument not specified for parameter 'arguments' of public function Select(arguments as System.Web.DatasourceSelect Arguments as Collections ienumerable
Help I have not got much more hair to loose
Thanks Steve
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!
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
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.
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
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.
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.
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
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.
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 RelatedI 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 RelatedHi,
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...
This is driving me nuts..
I'm trying to extract some data from a table in oracle. The oracle table stores date and time seperately in 2 different columns. I need to merge these two columns and import to sql server database.
I'm struggling with this for a quite a while and I'm not able to get it working.
I tried the oracle query something like this,
SELECT
(TO_CHAR(ASOFDATE,'YYYYMMDD')||' '||TO_CHAR(ASOFTIME,'HH24:MM : SS')||':000') AS ASOFDATE
FROM TBLA
this gives me an output of 20070511 23:06:30:000
the space in MM : SS is intentional here, since without that space it appread as smiley
I'm trying to map this to datetime field in sql server 2005. It keeps failing with this error
The value could not be converted because of a potential loss of data
I'm struck with error for hours now. Any pointers would be helpful.
Thanks
"Procedure or function sptblTrgFACalculator_Insert_v2 has too many arguments specified"
This error was produced when i tried to insert 12 arguments into my table.Is there a limit to the number of arguments you can pass into your stored procedure?
I Have a sql select statment and i need to trim white space off one of my columns .
How do I do that please help.
Could somebody please give me a syntax that I can use to trim spaces. I have used and I still have the spaces. :
UPDATE MAP SET ROAD = RTRIM (STREET)
UPDATE MAP SET ROAD = LTRIM (STREET)
We are trying to clean up spaces at road intersections. Thanks for your assistance.
I have some data that contains spaces both before and after the text string, and now I'm wondering what would be the best method to remove these blanks (sometimes there are no blanks, so I can't check with a specifik width)?
Is it possible to do something like:
set foo = ltrim(rtrim(foo))
or do I have to split it into 2 steps?
This trimming will be done in update & insert statements
// Pati
How do i remove carriage returns in SQL Server ? each of the lines have a carriage return as well as in front and back of the text.
Keith Waltin
Transport Ticketing Authority
03 9651 9066
I've tried the
update test.dbo.test
set bodytext1 = ltrim(rtrim(bodytext1))
but the whitespace/carriage returns still exists in the back and front of the text ? Anyone got any ideas ?
Actually, I don't know what is the meaning and difference of "N" in thefunction.Thanks.
View 1 Replies View Related
can anyone explain me what happens when we write the above for a col.
I k now it remove spaces but can anyone explain with exmpls
thanks
Hello All,
I am trying to ltrim a portion of multiple fields in a grouping. I am able to do it for one of them, but unfortunately there are several I have to do it for. If I use the following expression, it works for that one.
Code Snippet
=iif(Fields!BankNumber.Value="083" and Fields!TestName.Value="Inquiry Menu - Bank 083",LTRIM("Inquiry Menu"),Fields!TestName.Value)
However, if I try and do it for more than one it errors out. For example...
Code Snippet
=iif(Fields!BankNumber.Value="083" and Fields!TestName.Value="Inquiry Menu - Bank 083",LTRIM("Inquiry Menu"),Fields!TestName.Value)
OR iif(Fields!BankNumber.Value="083" and Fields!TestName.Value="Search Menu - Bank 083",LTRIM("Search Menu"),Fields!TestName.Value)
OR iif(Fields!BankNumber.Value="083" and Fields!TestName.Value="SEAX - Bank 083",LTRIM("SEAX"),Fields!TestName.Value)
Is there another way to arrange this so I can LTRIM each field group seperately?
Thanks,
Clint
Is there any step by step help sites for setting up SQL 2005 linked (oracle 10) server?
I find MSDN articles but they referance winNT and 2000, I'm not getting very far and I'm not a DBA but need to get this working asap.
we recently got a scenario that we need to get the data from oracle tables which is installed on third party servers. we have sqlserver installed on ourservers. so they have created a DBLINK in oracle server to our sqlserver and published the DBLINK name.
what are the next steps that i need to follow on my sqlserver in order to access the oracle tables ?
Hi i have a select statement as
select empnum, len(empnum), ltrim(rtrim(empnum)), len(ltrim(rtrim(empnum))) from employee
When i execute this stament i get the following
1234 61234 6
4321 84321 8
1111 61111 6
2222 62222 6
How does this happens. Why ltrim and rtrim is not working here.
You all have been so much help, but I've discovered yet another problem. I'm trying to clean up my table using the following command:
UPDATE dbo.TableName
SET First_Name = LTrim(RTrim(First_Name))But it does not seem to have any effect. Thoughts? Thanks!
How do I "ltrim" an enire colum?
Thanks,
I imported data into a database and the first character in an ID Field starts with %. This is causing many problems for the application. Unfortunately, this field exists in 72 of 128 tables in the database. Is there a way to LTRIM every ID field where the first character is %? This is easy in 1 Table but how do I apply it to all 72 tables at once? Thanks for for your assistance
View 6 Replies View RelatedI am trying to follow an SSIS tutorial. It is doing a transformation on mainframe data.
It has the statement LTRIM(State) == '' in the Condititonal split editor.
The data type is DT_STR.
Nothing works (dbl quote,brackets, ect)
I have also tried to change the type to DT_WSTR. According to docs ltrim only works with Unicode.
Can someone please tell me how to detect an empty string.
Thanks for any help
walter
Hi--
I am running SQL Server 2005 on Win2k3:
Microsoft SQL Server Management Studio 9.00.2047.00
Microsoft Analysis Services Client Tools 2005.090.2047.00
Microsoft Data Access Components (MDAC) 2000.086.1830.00 (srv03_sp1_rtm.050324-1447)
Microsoft MSXML 2.6 3.0 4.0 6.0
Microsoft Internet Explorer 6.0.3790.1830
Microsoft .NET Framework 2.0.50727.42
Operating System 5.2.3790
I have the OraOLEDB.Oracle provider installed to the (C:oraclexe) directory.
I am having problems querying from linked oracle server. When i setup oracle as a linked server and purposely enter an incorrect password the query i run tells me i have an incorrect password. So it at least knows that. when i set the correct password and run a query I get this error:
(i replaced the real server name with "someServer".)
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "OraOLEDB.Oracle" for linked server "SomeServer" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "SomeServer".
This is how I set up my Linked server:
Provider: "Oracle Provider for OLE DB"
Product Name: SomeServer
Data Source: SomeServer
Provider String: "Provider=OraOLEDB.Oracle;Data Source=SomeServer;User Id=MyLogin;Password=MyPassword"
The query I run is:
Select * from [Someserver].[schema or database]..[tbl_name]
Any help??? What am i missing?
I'm not sure about why I'm not able to remove spaces even after trimming them. Below is the result of query I'm usning.
select distinct LTRIM(RTRIM(Promotion_Code)) Promotion_Code
--, count(Promotion_code)
from dbo.Marketing_Promotion_Tb
where Promotion_code like '%1BTPIZZA%'
Result :
Promotion_Code Length
1BTPIZZA 10
1BTPIZZA 8
Hi
I sent a long string of ID from front end to my stored procedure...till now I was using varchar(8000)...but if the string crossess that limit it is breaking.
If I try to use text datatype..It doesn't support rtrim, stuff functions etc...
So could any one suggest me a best way to save a long string without any restriction of size...
My front end is C#.Net and Back End is SQL SERVER 2000
Thanks in advance
Hi,I'm trying to store values from a session to sql server table. I created an sql stored procedure to pass the values into the database. For some reason when I'm running the website and trying to store value from session to database an error is being displayed with the following message "Procedure or function OrderFromCart has too many arguments specified". OrderFromCart is the name of the stored procedure. Any Ideas??ThanksInter FC
View 11 Replies View Related