I'm trying to update data of a table using Job Scheduler in sql server 2012.
the following query is being executed:
UPDATE COM_TB_Inventory
SET Location = 'Transit'
WHERE Location = 'On Order' AND SDate IS NOT NULL
AND CONVERT(DATE,CONVERT(DATETIME,SDate,103)) = CONVERT(DATE,GETDATE())
Here, 'sDate' field contains date but it's a varchar type of data field. If I execte this query manually then it works. But the scheduler is not working. I'm getting the following error:
Executed as user: NT SERVICE\SQLSERVERAGENT. Warning: Null value is
eliminated by an aggregate or other SET operation. [SQLSTATE 01003]
(Message 8153) Subquery returned more than 1 value. This is not
permitted when the subquery follows =, !=, <, <= , >, >= or when the
subquery is used as an expression. [SQLSTATE 21000] (Error 512) The
statement has been terminated. [SQLSTATE 01000] (Error 3621). The
step failed.
a little help will be much appreciated. thnx
Related
I am attempting to correlate two databases together with the following query:
SELECT AE.EventTimeStamp, AE.SourceName, AE.Message, AE.Severity, AE.GroupPath
FROM FTAE_History.dbo.AllEvent AE
JOIN BatchHistoryEx.dbo.SequenceActiveUnit ActiveUnits
ON #RecipeName = ActiveUnits.SequenceName
AND ActiveUnits.ActiveUnit like (CONCAT('%',RIGHT(AE.GroupPath,CHARINDEX('.',REVERSE(AE.GroupPath))-1),'%'))
WHERE AE.EventTimeStamp between #StartTime_UTC and #EndTime_UTC
AND LEN(AE.GroupPath) > 13
AND AE.Active = 1
AND AE.Severity >= 500
ORDER BY EventTimeStamp
When run in SQL Management Studio, I can execute on any #RecipeName or #StartTime_UTC/#EndTime_UTC. When I embed this query in an SSRS dataset, some #RecipeName's or times throw this error:
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'GetUniqueID_BatchIDForAlarms'. (rsErrorExecutingCommand)
An expression of non-boolean type specified in a context where a condition is expected, near ','.
The error is happening inside the JOIN statement - when I remove that block all possible parameters entered execute even in SSRS. What is causing the difference? How best do I implement an error handling system to allow this query to execute without exceptions?
The nested query only show a single row. When I add more data, it throws an error.
I'm using SQL Server 2014.
SELECT
ListaMaestra.id_ListaMaestra, ListaMaestra.Clave,
ListaMaestra.Nombre_P, ListaMaestra.Modulo_P,
ListaMaestra.Caracteristicas, ListaMaestra.Tipo_Formato,
ListaMaestra.Fecha_Emision, ListaMaestra.Fecha_Revision,
ListaMaestra.Revision, ListaMaestra.Norma,
empleado.nombre, cargo.nombre_cargo,
(SELECT empleado.nombre FROM ListaMaestra, empleado
WHERE ListaMaestra.Nombre_Reviso = empleado.id_empleado) AS Nombre_Elaboro,
(SELECT cargo.nombre_cargo FROM ListaMaestra, cargo
WHERE ListaMaestra.Cargo_Reviso = cargo.id_cargo) AS Cargo_Elaboro,
ListaMaestra.Estatus, ListaMaestra.Ruta_PDF
FROM
ListaMaestra, empleado, cargo
WHERE
ListaMaestra.Nombre_Elaboro = empleado.id_empleado
AND ListaMaestra.Cargo_Elaboro = cargo.id_cargo
ERROR:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The problem should go away if you remove ListaMaestra from the from clause of each subselect, since you've already referenced ListaMaestra in the from clause of the main select.
I need help with this Query, I'm making some calculations based on some results, but I'm receiving the following error:
Sybase Database Error: Invalid data conversion.
The query is as follows:
SELECT
DC.DIM_DATE.DATE_ID,
DC.DIM_E_RAN_UCELL.RBS_ID,
(SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestDchPsIntRabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumFachPsIntRabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestPsHsAdchRabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestPsEulRabEstablish))/720 AS '3G_DATA_ERLANG',
(SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestCs12Establish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestAmr12200RabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestAmr7950RabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestAmr5900RabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestAmr4750RabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestAmrWbRabEstablish)+SUM(DC.DC_E_RAN_UCELL_RAW.pmSumBestAmrNbMmRabEstablish))/720 AS '3G_SPEECH_ERLANG',
(100*(SUM(DC.DC_E_RAN_UCELL_RAW.pmTotNoRrcConnectReqCsSucc)/(1+SUM(DC.DC_E_RAN_UCELL_RAW.pmTotNoRrcConnectReqCs)-SUM(DC.DC_E_RAN_UCELL_RAW.pmNoLoadSharingRrcConnCs))*(SUM(DC.DC_E_RAN_UCELL_RAW.pmNoRabEstablishSuccessSpeech)+SUM(DC.DC_E_RAN_UCELL_RAW.pmNoRabEstablishSuccessCs64)+SUM(DC.DC_E_RAN_UCELL_RAW.pmRabEstablishEcSuccess))/(SUM(DC.DC_E_RAN_UCELL_RAW.pmRabEstablishEcAttempt)+SUM(DC.DC_E_RAN_UCELL_RAW.pmNoRabEstablishAttemptSpeech)+SUM(DC.DC_E_RAN_UCELL_RAW.pmNoRabEstablishAttemptCs64)-SUM(DC.DC_E_RAN_UCELL_RAW.pmNoDirRetryAtt)))) AS '3G_CSSR_CS'
FROM
DC.DIM_DATE,
DC.DIM_TIME,
DC.DIM_E_RAN_UCELL,
DC.DC_E_RAN_UCELL_RAW
WHERE
(DC.DC_E_RAN_UCELL_RAW.HOUR_ID=DC.DIM_TIME.HOUR_ID and DC.DC_E_RAN_UCELL_RAW.MIN_ID=DC.DIM_TIME.MIN_ID)
AND (DC.DC_E_RAN_UCELL_RAW.DATE_ID=DC.DIM_DATE.DATE_ID)
AND (DC.DC_E_RAN_UCELL_RAW.OSS_ID=DC.DIM_E_RAN_UCELL.OSS_ID)
AND (DC.DC_E_RAN_UCELL_RAW.RNC=DC.DIM_E_RAN_UCELL.RNC_ID)
AND (DC.DC_E_RAN_UCELL_RAW.UtranCell=DC.DIM_E_RAN_UCELL.UCELL_ID)
AND
(
DC.DIM_DATE.DATE_ID IN ('2017-08-14')
AND
DC.DIM_E_RAN_UCELL.RBS_ID IN ('DN1U0441')
)
GROUP BY
DC.DIM_DATE.DATE_ID,
DC.DIM_E_RAN_UCELL.RBS_ID
The problem is with the last row of the SELECT statement, without it the result is this:
DATE_ID RBS_ID 3G_DATA_ERLANG 3G_SPEECH_ERLANG
8/14/2017 DN1U0441 421.8541 33.5055
When is included I got this error:
Lookup Error - Sybase Database Error: Invalid data conversion
Any Help? Is Sybase ASE DataBase
please am trying to apply for a request from my website that am working on and l got this error:
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The 'CalCulateClaimForDeath' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead.
The Source Error pointed me to this code:
Line 239:
Line 240: //finally, execute the command.
Line 241: int retval = cmd.ExecuteNonQuery();
Line 242:
Line 243: // detach the SqlParameters from the command object, so they can be used again.
Help is needed.thank you
I'm trying to form a query that returns a list of entities within a given rectangle, using SDO_WITHIN_DISTANCE. The query I've made seems like it should work, but Oracle is giving me some strange errors. Here's the query:
SELECT *
FROM TBLENTITYLOCATION TL
INNER JOIN TBLENTITY TE
ON TE.ENTITYID=TL.ENTITYID
WHERE SDO_WITHIN_DISTANCE (TL.GEOLOCATION
, SDO_GEOMETRY (2003
, NULL
, NULL
, SDO_ELEM_INFO_ARRAY(1, 1003, 3)
, SDO_ORDINATE_ARRAY(41, -73, 36, -82)
), 'DISTANCE=10 UNIT=M'
) = 'TRUE'
AND TL.LOCATIONDATETIME= (select MAX(LOCATIONDATETIME)
FROM TBLENTITYLOCATION
WHERE ENTITYID = TE.ENTITYID)
The error is as follows:
ORA-29902: error in executing ODCIIndexStart() routine
ORA-13208: internal error while evaluating [window SRID does not match layer SRID] operator
ORA-06512: at MDSYS.SDO_INDEX_METHOD_10I", line 286
OERR says:
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and take appropriate action.
Thanks for any help or ideas.
The ORA-13208 error is the prime one here.
The TL.GEOLOCATION needs a matching value in the SRID (second parameter of the SDO_GEOMETRY)
See if the response here helps you out.
Gary Myers provided correct answer, let me augment it. If you don't know which SRID is used by your table, do a query:
select SRID from USER_SDO_GEOM_METADATA where TABLE_NAME='TBLENTITYLOCATION' and COLUMN_NAME='TBLENTITYLOCATION'
Also, to query for objects which are within a rectangle, you don't need SDO_WITHIN_DISTANCE operator. Instead, use SDO_RELATE with mask=ANYINTERACT. See http://docs.oracle.com/cd/B12037_01/appdev.101/b10826/sdo_operat.htm#i78531 for more details.