I have Sybase database 15 and one of oracle query wanted to convert into sybase Database.
I have tried all option but not able to find google so i need your help
select Log_record_id,
Event_time,
SUBSTR (Object_of_reference,(LOCATE (Object_of_reference, '=', 1, 2) + 1),((LOCATE (Object_of_reference, ',', 1, 2) - LOCATE (Object_of_reference, '=', 1, 2)) - 1)) as NENAME,
Perceived_severity,
Specific_problem,
'' as Cease_time,
Alarm_id,
SP_text,
Alarm_state
from FMA_alarm_list
where Log_record_id > 63314472
Getting Error
Msg 14216, Level 16, State 1: Server 'SYBASESERVER', Line 1: Function
'INSTR' not found. If this is a SQLJ function or SQL function, use
sp_help to check whether the object exists (sp_help may produce a
large amountof output).
Related
Very often we are unable to use Partitioned reads in Netezza connector.
Example
When partitioned read = Yes and Generated SQL at Runtime = Yes this works:
SELECT "Firma", "KundeNr", "ArtikkelNr"," LagerstedNr"
FROM dwhusr."TI_FT_Salg"
When Generated SQL at Runtime = No and the query is Autogenerated by DataStage (or we write it our selves) the query looks like this:
SELECT "Firma", "KundeNr", "ArtikkelNr"," LagerstedNr"
FROM dwhusr."TI_FT_Salg"
WHERE mod(datasliceid,[[node-count]])=[[node-number]]
It will then throw an error:
DB_TI_FT_Salg: Unexpected ODBC error occurred. Reason: [SQLCODE=42000][Native=27] ERROR: 'SELECT "Firma", "KundeNr", "ArtikkelNr"," LagerstedNr" FROM dwhusr."TI_FT_Salg" where mod(datasliceid,[[node-count]])=[[node-number]] limit 0'
error ^ found "[" (at char 102) expecting an identifier found a keyword (CC_NZMetadataHelper::describeResultSet, file CC_NZMetadataHelper.cpp, line 5 622)
Please help!
It is possible to use SQL Server's Open Query, with Oracle With AS clause, in query?
SELECT * FROM OPENQUERY(OMSP,
'
WITH OrderReserve AS
(SELECT cvwarehouseid,
lproductid,
SUM(lqty) lqty
FROM iOrdPrdQtyDate
GROUP BY cvwarehouseid,
lproductid)
SELECT CGPCPRD.DWPRDOID, V_LPRODUCTID_DWBOBJECTOID.DWBOBJECTOID
FROM xxx.CGPCPRD CGPCPRD
...
LEFT JOIN OrderReserve ON (
OrderReserve.cvWarehouseId = CGCCWAREHOUSEPARTY.CVWAREHOUSEID
AND OrderReserve.lProductId = V_LPRODUCTID_DWBOBJECTOID.LPRODUCTID
)
')
Without this (and join which use this With AS) query works. I get this error:
OLE DB provider "OraOLEDB.Oracle" for linked server "OMSP" returned
message "ORA-00942: table or view does not exist". Msg 7321, Level 16,
State 2, Line 1 An error occurred while preparing the query " WITH
OrderReserve AS (SELECT cvwarehouseid, lproductid, SUM(lqty) lqty
FROM iOrdPrdQtyDate GROUP BY cvwarehouseid, lproductid) ...
This passed query works in Oracle.
SELECT IPD.Task_grp "Task Group", TASK.STARTW "Starting Area", TASK.ENDW "Destination Area", IPD.Nxt_Work_Grp,IPD.Nxt_Work_Area
"Drop Area", IPD.Prty "Priority", IPD.Stat_Code "Status"
FROM int_path_defn IPD,
(SELECT start_curr_work_grp || start_curr_work_area StartW,
start_dest_work_grp ||start_dest_work_area EndW
FROM task_hdr WHERE task_id='332800') TASK WHERE IPD.CURR_WORK_GRP || IPD.Curr_Work_Area=TASK.StartW
AND IPD.Dest_Work_Grp || IPD.Dest_Work_Area=TASK.ENDW
I am getting
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '|'.`
Please help what could be the wrong. same query executed successfully in oracle sql developer
SQL Server uses + for string concatenation instead of ||.
The syntax is wrong. "||" - even "|" - has no sense in TSQL.
Which means either the person writing this SQL has no clue OR - more likely - it is coming from another server type. Bad news: SQL is not really standardized, everyone has his own extensions.
Time to do your job and fixing the syntax. And yes, this can be tendious work.
when i run this query
SELECT *
FROM OPENQUERY([XXX], 'SELECT * FROM Database.Table WHERE (MBCONO=650) AND MBCUNO LIKE a%' )
Get the Error :
OLE DB provider "DB2OLEDB" for linked server "XXX" returned message
"Token %ŸFOR SKIP WITH FETCH ORDER UNION EXCEPT OPTIMIZE SQLSTATE:
42601, SQLCODE: -104".
Msg 7321, Level 16, State 2, Line 1 An error
occurred while preparing the query "SELECT * FROM Database.Table WHERE
(MBCONO=650) AND MBCUNO LIKE a%'" for execution against OLE DB
provider "DB2OLEDB" for linked server "LAWSON".
But when I run the Same query Without AND MBCUNO LIKE a% Return Result !!
Any One Can Help Me About This Issue
Thanx
Have you tried putting escaped single quotes around the LIKE condition?
SELECT *
FROM OPENQUERY([XXX], 'SELECT * FROM Database.Table WHERE (MBCONO=650) AND MBCUNO LIKE ''a%''' )
If this doesn't work, try running the query directly against the target server.
I am attempting to add an attribute to a node in an XML column in SQL Server.
UPDATE
TableName
SET Metadata.modify('
insert attribute MyAttribute{"01b9cd0b-bfed-436f-bc58-57d2fddd9211"}
into (Root/Collection/Item[#No="360"][1])
')
WHERE
TableName.Id = 1
I get the following error...
Msg 2226, Level 16, State 1, Line 4 XQuery
[TableName.Metadata.modify()]: The target of 'insert' must be a single
node, found 'element(Item,xdt:untyped) *'
But I thought my selection would return a single item, given the [1]
Stupid XQuery! (Or possibly me).
You need to place the [1] outside of the brackets:
into (Root/Collection/Item[#No="360"][1])
Should be
into (Root/Collection/Item[#No="360"])[1]