Problem in the The Query... to search a part of Record
HI friends,
I have to serach some records from the table. But the records in the table are like this
Uname----------DocNo---------- DocDate
ashish----------vsg-1000----------07-23-2007
leena----------vsg-1001----------07-20-2005
chinu----------vsg-1059----------12-12-2006
Now user is giving a range say: startingDocNo: 1005 endDocNo: 1045
Here the query should return all the records between
vsg-1005 to vsg-1045.
How can i search this. What is the procedure to do this. vsg- is always prefixed to the no.
Please tell me about this. thanks for your answer in advance..
You can use LTRIM function in the where clause to trim 'vsg-'.
E.g:
select uname,docno,docdate
from table1
where to_number(ltrim(docno,'vsg-')) between 1005 and 1045PS: To improve the performance, create a function based index on to_number(LTRIM(docno,'vsg-'))
Similar Messages
-
Hi
DECLARE @XMLA nvarchar(3000)
, @DateSerial nvarchar(35);
-- Change date to format YYYYMMDDHHMMSS
SET @DateSerial = CAST(GETDATE() AS DATE);
--SELECT @DateSerial
Set @XMLA =
N' <Batch xmlns="http://schemas.microsoft.com/analysis services/2003/engine">
<ErrorConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2"
xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200"
xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
<KeyErrorLimit>-1</KeyErrorLimit>
<KeyNotFound>IgnoreError</KeyNotFound>
<NullKeyNotAllowed>IgnoreError</NullKeyNotAllowed>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2"
xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200"
xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
<Object>
<DatabaseID>MultidimensionalProject5</DatabaseID>
<CubeID>giri</CubeID>
<MeasureGroupID>Fact Internet Sales</MeasureGroupID>
</Object>
<Type>ProcessFull</Type>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>';
EXEC (@XMLA) At SHALL-PCAdventureWorksDw ;
iam executive the query when iam getting below error.
[Execute SQL Task] Error: Executing the query "DECLARE
@XMLA nvarchar(3000)
, @DateSerial nvarch..." failed with the following error: "Incorrect syntax near '-'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly.
how to solve this error;
please help meWhat are you trying to do? What sort of data source is SHALL-PCAdventureWorksDw?
When you use EXEC() AT, I would execpt to see an SQL string to be passed to EXEC(), but you are passing an XML string????
If you explain why you think this would work in the first place, maybe we can help you.
Erland Sommarskog, SQL Server MVP, [email protected] -
Hi .
I was creating the pass the values t in temp tables though s sis package vs2012 .
First I was taken on executive SQL TASK.
IN EXCUTIVE SQL TASK . I was write the stored proce:
Sp;
reate procedure USP_GETEMP2333
AS
begin
Select eid,ename,dept,salary from emp
end;
create table #temp(eid int,ename varchar(20),dept varchar(20),salary int)
insert into #temp
exec USP_GETMP02333
go.
It was executive correctly.
I was taken another sequence container. In the sequence container iam creating one executive sql
In 2<sup>nd</sup> excutive sql task: sql statements is
if object_id('emp_fact_sal') is not null
drop table emp_fact_sal
select eid,ename as emp_name,sal_bar=
case when salary<=5000 then 'l'
when salary >5000 and salary<=7000 then 'm'
else
'h'
end
into emp_fact_sal from #temp.
and one falt flies it was taken to designation .
iam changing all connection properties:
in oldeb connection:
in excutive sal task properties .
delay validation is true,
and retain connection maner is also true,
and package mode is 64 bit is false.
But iwas excutive in 2<sup>nd</sup> excutive ql task .
Iam getting this type of errors,
[Execute SQL Task] Error: Executing the query " if object_id('emp_fact_sal') is not null
drop ta..." failed with the following error: "Invalid object name '#Temp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established
correctly.
Please help meArthur suggestion works but you shouldnt even be doing this on a SQL Task.
Use a data flow task. You'll have better control over the data that is being transfered and get better performance because no staging table will be used.
Just because there are clouds in the sky it doesn't mean it isn't blue. But someone will come and argue that in addition to clouds, birds, airplanes, pollution, sunsets, daltonism and nuclear bombs, all adding different colours to the sky, this
is an undocumented behavior and should not be relied upon. -
Can't find out the problem in the query.
emp Table->
(name varchar2(10),
shot_seq varchar2(1)
The emp table contains around 2 million records.
When I run the following query the output comes within 20 seconds.
select name,sum(decode(shot_seq,1,1,0)) as pd2 from emp where shot_seq = 1
group by name;
But when i made the change in the query by putting ' shot_seq = '1' ', so that query is now:
select name,sum(decode(shot_seq,1,1,0)) as pd2 from emp where shot_seq = '1'
group by name;
The output doesn't comes, sqlplus just hangs up.
Please explain what is the reason behind this.
Thanks for ur time,
skala.1.
I think the problem is with sum and decode part:
..sum(decode(shot_seq,1,1,0)) as ...
If <shot_seq> is character then you need to convert it to_number before using any group functions....
2.
Check your decode:
......(shot_seq,1,1,0)) as pd2 from emp where shot_seq = '1'
I think it should be something like that(after you convert chars to nums)....
null -
Hai All,
I have created a login form in screen painter (which contains two textbox and a login button). When login button is clicked, I want to check whether the username and password matches in the table (@EMPA).
I have a problem while checking with the query
This is User Defined Function a have used
Private Sub UDFCheckInTableLog()
Try
Dim rs As SAPbobsCOM.Recordset = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery("SELECT T0.U_user FROM [dbo].[@EMPA] T0 WHERE T0.U_user ='" & euser & "' AND TO.U_pass ='" & epass & "'")
rscount = rs.RecordCount
If rscount > 0 Then
'//There is a record that Matches
REC = True
'//To clear the values in the text box
UDFClear()
Else
'//This means NO Record Matches
REC = False
End If
Catch ex As Exception
SBO_Application.MessageBox("UDFCheckInTableLog :" & ex.Message)
End Try
End Sub
I get this error message
UDFCheckInTableLog:
1)[microsoft][ODBC SQL Server Driver][SQL Server] Incorrect syntax near the keyword 'TO'.
2))[microsoft][ODBC SQL Server Driver][SQL Server] Statement(s) could not be prepared.Hi,
You're trying to use Table Alias(T0), i'm guessing its not allowed. Try also to remove dbo, try @EMPA or just EMPA.
HTH
Manuel -
Hi gurus,
I have a problem in a query
I have a lot of records that are the same and I dont want to sum the value of them more than once. How can this be done??
The following table should illustrate my problem:
DEPT--MONTHCFBID----SCORE
ALST--APR100--
3
ALST--MAY100--
3
ALST--JUN101--
4
ALST--APR102--
5
Overall Score 15
I want the Overall Score to be 12. (only summing up unique records Of CFBID).
Any help will be greatly appreciated.
Regards
Supraja.KHi,
I had Done with Formula with Excveption Aggregation as Average And reference charecterstic as CFBID
DEPT--MONTHCFBID----SCORE
ALST--APR100--
3
ALST--MAY100--
3
ALST--JUN101--
4
ALST--APR102--
5
Overall Score 15
I want the Average Score12/3 = 4.
but I am getting as 15/3 = 5
What to Do any other Solution please -
Case Sensitive Problem in the query
Hii All
Good Day
I have created zperson infoobject & has lowercase letters tick marked.
This is the navigational attribute of 0activity infoobject.
The user wants to have the functionality of
"The text field should be non-case sensitive so when it is used in a query to search the name can be typed in whichever case a person wants"
How to do this? can any one suggest?
regards
Jana.Hello,
I dont have a solution to convert the value automatic in the selection variables. but as an alternate solution: When you load data for zperson, use formula or routine to translate to upper case. Then the user can always use uppercase in the selection.
Happy Tony -
I am facing problem using RRI feature.
In my first Query I have Two customer Exit variables to fetch values of 2 dates and i am showing records for dates in between them. The query is working very fine.
Now jumping from this query to another Query which will display all data where a date(different info object than query 1) lies between two dates of previous query(which are customer exit variable).
I can filter data in my second query by applying range of values to both the customer exit variables of query 1.Please help.
Now I just want to know how to pass the values of the customer exit variables form query 1 to query 2.
Message was edited by: SachinHi,
You're trying to use Table Alias(T0), i'm guessing its not allowed. Try also to remove dbo, try @EMPA or just EMPA.
HTH
Manuel -
Enhancin the query BT1O SEARCH
Hi,
I am in CRM 7.0.I am trying to add new fields in the query object CRMST_QUERY_1ORDER_BTIL in order to enhance the 1 order search .
So what steps do i need to follow henecforth in order to ensre the serach is working ?
I currently get a dump when i click on the search button in the UI.
The dump is from the method make_instance_valid of cl_crm_report_accrule.
Please let me know how to proceed.
SuvidhaHi,
you will find your anser in the following note:
Note 1527039 - Enhancements in CRM Reporting Framework
read this and the attached documents.
br
Jürgen -
Problem executing the Query.
Hi,
When I am trying to open a Query in the Query Designer I am getting the error, like
Error Characteristic BP in Ext.Sys (BPCo) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BPEmp) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BP R) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BP-P) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BPSh-P) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BPSldTo) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BPSrvEm) must be uniquely selected in the query
Error Characteristic BP in Ext.Sys (BPR) must be uniquely selected in the query
It may be due to a characteristic 0BP_EXTERN- Previous Account Number which is a Navigation Attribute of all these characteristics,
*0CRM_SOLDTO, 0CRM_SHIPTO, 0CRM_BILLTO, etc etc. So all these characteristics which are associated with 0BP_EXTERN are having some problem.
All those Queries where 0BP_EXTERN is used are having the same issue. There used to be no issue till yesterday, I was able to execute the Query.
Can anybody help me solving this issue??
Thanks in advance.
PrasapbiAlso, when I went to InfoObject Properties,
Business Explorer--> Selection --> "Unique for Every Cell" (this option is selected for the InfoObject 0BP_EXTERN),
Or will it work if I select the option "No Selection Restriction".
Thanks
Prasapbi -
Hierarchy Nodes Display problem in the query
Hi
I have an organizational hierarchy upto 6 levels of nodes.
When it is displyed in the query only the first three levels are getting displayed.
When i see in the restricted area ( when restricting values ) i find all the nodes displayed but when query is executed i dont see anything.
Are there setting thats needs to be made in order to see the entire hierarchy.
regards
sundaresanWhen you restrict any query you can see all the nodes of hierarchy, but when you run it you can see only those nodes for which value exists in infoprovider.
Corss check if you have any other restrictions also. -
TP problems, transporting the query views
Hello Expert's
I created two query views on the exiting querys, now i transporting the two views,
How to do transfer the views,
i am confusing following procedures,
1. In RSA1 -> Transport Connector ->Object types -> query views ->Two query views are selected. YES (or)No
2. If selecting views i am not selecting the query and query elements, only the views. YES (or) No
3 And i saved the querys in Package and created a TP. YES (or) No
if selecting the query views after that what i has done
please suggest me suitable answer
it urgent
thanks in advance
aravind.sHello Anand,
1. In RSA1 -> Transport Connector ->Object types -> query views ->Two query views are selected. YES (or)No
Yes, Collect only the view if the Query is already transported. If the query is not transported then select the Query with Dataflow afterwards it will collect all the views as well.
2. If selecting views i am not selecting the query and query elements, only the views. YES (or) No
Yes, if the query are already transported.
3 And i saved the querys in Package and created a TP. YES (or) No
Yes, definitely you have to capture these views in a package and transport request.
Once the views are collected in a transport request , release the request and inform the transport team to import to the target system (Qual or Prod)
Note : In BI/BW BEx tranports are handled differently and not like other objects such as InfoCube, InfoObject. So whenever you are working with BEx Objects make sure that you assing a transport request in the following
RSA1->Transport Connect -> BEx Icon (Truck Symbol) -> Assign Package and Request using the Assign Button.
If you transport system is configured to capture the BEx objects during creation or modification then the above step is not required.
Thanks
Chandran -
Problem with the query of Sharepoint Calculated Fields
Hello,
I am developing an application in sharepoint 2013 foundation. but i have problems with a list, when executing a caml query on a calculated field. I try the solution of this blog
http://sptalks.wordpress.com/2013/03/25/query-on-calculated-field-problem
but i got no result
attentive to any comments
thanksHello,
This is my CAML Query
<View>
<ViewFields>
<FieldRef Name="ID" />
<FieldRef Name="PermMask" />
<FieldRef Name="FSObjType" />
<FieldRef Name="Nombre" AutoHyperLink="TRUE" />
<FieldRef Name="Apellidos" AutoHyperLink="TRUE" />
<FieldRef Name="Cargo" /><FieldRef Name="Edad" />
<FieldRef Name="Compa_x00f1_ia" />
<FieldRef Name="Created" />
</ViewFields>
<Query>
<GroupBy Collapse="TRUE" GroupLimit="30">
<FieldRef Name="Compa_x00f1_ia" />
<FieldRef Name="Edad" />
</GroupBy>
<OrderBy>
<FieldRef Name="ID" />
</OrderBy>
<Where>
<Contains>
<FieldRef Name="Ano" LookupId="FALSE" />
<Value Type="Text">2014</Value>
</Contains>
</Where>
</Query>
</View> -
Problem with the query in group by clause
hi, i have problem with group by clause, can some one please help me.
select
header_id,
(select sum(nvl(dr,0) - nvl(cr ,0)) from temp_tab a1
where
a1.country=a.country
and a1.source='AP'
and a1.header_id=a.header_id) WHT,
sum(dr),
sum(cr) from temp_tab a
group by header_id,
(select sum(nvl(dr,0) - nvl(cr ,0)) from temp_tab a1
where
a1.country=a.country
and a1.source='AP'
and a1.header_id=a.header_id)
select * from temp_tab
drop table temp_tab
create table temp_tab(header_id number ,line_num number, country varchar2(2),
source varchar2(2), dr number, cr number,primary key(header_id,line_num));
insert into temp_tab(header_id, line_num,country, source, dr,cr) values(1, 1,'NL','AP',100,20);
insert into temp_tab(header_id, line_num,country, source, dr,cr) values(1, 2,'PO','AP',20,20);
insert into temp_tab(header_id, line_num,country, source, dr,cr) values(1, 3,'NL','AP',70,20);
insert into temp_tab(header_id, line_num,country, source, dr,cr) values(2, 1,'NL','PA',100,20);
insert into temp_tab(header_id, line_num,country, source, dr,cr) values(2, 2,'NL','PA',100,20);
insert into temp_tab(header_id, line_num,country, source, dr,cr) values(3, 1,'KR','PO',100,20);
commit;
Appreciate your help.
Thanks,select header_id,
(select sum(nvl(dr,0) - nvl(cr ,0)) from temp_tab a1
where a1.country=a.country
and a1.source='AP'
and a1.header_id=a.header_id) WHT,
sum(dr),
sum(cr)
from temp_tab a
group by header_id
,countryIt's kinda hard to follow what your query does... maybe because I'm only at my second coffee..
Edited by: Alex Nuijten on Oct 2, 2009 8:07 AM -
Control the query of Content By Search web part or a Catalog-Item Reuse web part from JavaScript
Is it possible/supported to intercept and change the query before it gets issued by a Content By Search or Catalog-Item Reuse webpart?
I am writing a multilingual site utilizing cross-site publishing mechanism, and the out-of-box (OOB) web parts would perfectly work if not for the following requirement that I've got: I need to serve location-specific content to the end user. I have several
versions of each content page for each geographical location, and I have tagged the pages accordingly with managed metadata keywords. I also can deduce the user's location from her browser's IP address and store it in a JavaScript variable. It is here
where I am getting stuck: I am trying to change on the fly the queries the web parts issue in order to attach the information about the user's geographical location, unsuccessfully so far.
I cannot rely on server-side code unless it is a cloud-hosted app code. I am about to give up and consider a custom solution alternative instead, which would be relying on Search REST API and custom client-side scripted widgets in place
of the OOB search web parts. This seems like an expensive alternative as the entire site could have been built using the OOB web parts, if not for the location requirement.
I would appreciate any suggestions.
Thanks in advance,
Ivan.hi
I would check several directions:
- in query transformation you may add keyword filter "Value of a field on the page". Documentation doesn't clearly says what "field" means here: is it only for site columns, or also may work for UI controls on the page. In second case it would solve your
problem (it would be possible to add hidden field on the page and set value via javascript). But chances that it works like this are not high;
- in the query settings of the Content by search web part there is setting "Loading behavior": Choose whether this query is issued on the server while the page is loading, which is better for your main content, or from the browser after the page appears.
I.e. if you will choose 2nd option there will be a chance to intercept the query on the client side in theory. All of this requires experimenting of course;
- by default Content by search web part sends query to /_vti_bin/client.svc/ProcessQuery with http post from client side (you may check it in fiddler). You may try to find the exact javascript function which performs the call and override it by adding additional
conditions to the query (fortunately it is not complicated in javascript).
Blog - http://sadomovalex.blogspot.com
Dynamic CAML queries via C# - http://camlex.codeplex.com
Maybe you are looking for
-
VARRAY as Stored Proc output parameter
VARRAY as Stored Proc output parameter I have an Oracle VARRAY data type declared as follows: CREATE TYPE NUMBER_ARRAY AS VARRAY(100) OF NUMBER; I have a stored procedure which takes a single input and returns a NUMBER_ARRAY as output: CREATE OR REPL
-
License question how do you release a license?
Hi all, I attended 360Flex this past week and as I don't have a laptop I needed to use a loaner lap top from our IT Department. I installed Flex 2 on it and used my License for it but now need to uninstall the program and release the license. I went
-
NOkia 101 rm 769 brought to canada not working wit...
Hi, When I was in Asia, i got a Nokia 101 RM 769. I took it with me to Canada to replace my stolen Nokia, but it is not working with my provider's SIM card (CHATR). How come?? What should I do? There is not information on the website, no way to talk
-
Connecting to a home network with D-Link G122
Help anybody. I have an old Blue & White iMac 10.2.8, am trying to get it to link up to our network at home via a D-Link G122 USB Wireless adaptor and am on the the third set of drivers. Saw from another site that this was not a very good setup, any
-
Why does the iPhone 4S shut off by itself?
I didn't notice it at first but when I go to use my iPhone 4S it was off, without me shutting it off or anything. This is the first time it's happened to me and I'd like to know why it shuts off by itself.