How to select records filter by the value which stored in xml field
I read many datas to solve my problem,but those doesn't work...
At first, I create a table in sqlserver
CREATE TABLE [dbo].[Demo](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Content] [xml] NOT NULL
Then I insert two records:
INSERT INTO Demo(Content) VALUES(
'<plan>
<teachers>
<teacher>1</teacher>
<teacher>2</teacher>
</teachers>
</plan>')
INSERT INTO Demo(Content) VALUES(
'<plan>
<teachers>
<teacher>3</teacher>
<teacher>4</teacher>
</teachers>
</plan>')
Now ,I want to get the records which the Content field's teacher=3. I try my best to sovle it ,but I can't.
Are there somebody can help me? Thanks !
You can use the .exist method to do that. Try these:
SELECT *
FROM Demo
WHERE Content.exist('plan/teachers/teacher[. = 3]') = 1
DECLARE @teacherId INT = 3
SELECT *
FROM Demo
WHERE Content.exist('plan/teachers/teacher[. = sql:variable("@teacherId")]') = 1
Similar Messages
-
when I scyn photo from pc to iphone , by using cable and selecting iphone on itunes, the photo which stored in my iphone , i am unable to delete some photo from them and even can not arrange them accoring to my wish, please let me know what to do ?
you can only delete the photos you take on the phone itself as in from camera roll
sync mean syncronize as in make the 2 side the same if you could delete the photos syncronized to your iphone then the nature of what syncronize mean result in the logic step being deleting the photo on your computer too
you get rid of the photo by sync with another dir/ sourse or by moving the photo out of the dir of the computer and then resync -
How to show a filter of the values in SCCM 2012 report?
I didn't see a forum for SCCM 2012 reporting, only SCCM 2007 Reporting, so I hope I am posting in the correct forum for this.
We upgraded to SCCM 2012 R2 and when running a report and entering values we can no longer type in a filter and then see a filtered list of values like in SCCM 2007.
Is there a solution for this? This was very useful especially in the Add/Remove report because many times we don't know exactly what to enter.
Below is a snapshot of what we did in SCCM 2007.Garth, unfortunately, I don't. I was fair at SCCM 2007 reporting and modifying SQL statements, but it seems everything has changed with SCCM 2012 reporting. For the specific SCCM 2012 report I mentioned, "Computers with specific software
registered in Add Remove Programs", is there some code I could paste in somewhere to get it to operate like the SCCM 2007 report?
Are you using BIDS or Report Builder. (Keep in mind that I recommend BIDS over RP)
Here are the basic steps:
Review the SQL for the Prompt
Add a variable to the prompt
Import; refresh the SQL query within the dataset
Move that the new variable is BEFORE the existing variable
Enter in the Prompt text “Enter computer filer”
Test to make sure everything is nice
Upload the report.
Garth Jones | My blogs: Enhansoft and
Old Blog site | Twitter:
@GarthMJ -
Select records based on the closest given time
Dear SQL gurus,
I have a table T1:
Name Null? Type
ID NOT NULL NUMBER(5)
MOMENT NOT NULL DATE [DD.MM.YYYY HH24:MI]
MEASUREMENT NOT NULL NUMBER(8,3)
Example (ID, MOMENT, MEASUREMENT)
-- START OF EXAMPLE --
9380 18.11.2000 03:45 17.6
9380 18.11.2000 04:30 17.3
9380 18.11.2000 05:45 16.8
9380 18.11.2000 06:15 16.8
9380 18.11.2000 07:00 16.2
9380 18.11.2000 07:30 16.2
9380 18.11.2000 08:15 16
9380 18.11.2000 08:45 15.7
9380 18.11.2000 09:30 15.4
9380 18.11.2000 10:00 15.4
9380 18.11.2000 11:15 15.4
9380 18.11.2000 11:45 15.4
9380 18.11.2000 12:30 15.4
9380 18.11.2000 13:00 15.4
9380 18.11.2000 13:45 15.4
--- END OF EXAMPLE --
How to select records based on the:
- time period specified by the day only [DD.MM.YYYY] - CONDITION 1
- with values for 6AM only, and if not available, with values closest to 6AM - CONDITION 2
(if the time gap in MOMENT field is too big, lets say > 5h then choose the average between the value before 6AM (ex. 4:15AM) and the value after the 6AM (ex. 9:45AM))
CONDITION 1 (something like): moment between '01.01.2005' and '31.12.2004' - this is OK
CONDITION 2: I do not know how to formulate, especially if 6AM value is not availabe, and I have to find the closest available value, or get the avergae from the two adjacent values.
Maybe cursor magic??? Thanks a lot for your help.
RadoAbout condition two, would the following select be of use to you? Picking the first record could be achived by rownum, analytic function, etc.
WITH t1 AS (SELECT 9380 id, TO_DATE('18.11.2000 03:45', 'dd.mm.yyyy hh24:mi') moment, 17.6 measurement
FROM dual
UNION
SELECT 9380 id, TO_DATE('18.11.2000 04:30', 'dd.mm.yyyy hh24:mi') moment, 17.3 measurement
FROM dual
UNION
SELECT 9380 id, TO_DATE('18.11.2000 05:45', 'dd.mm.yyyy hh24:mi') moment, 16.8 measurement
FROM dual
UNION
SELECT 9380 id, TO_DATE('18.11.2000 06:15', 'dd.mm.yyyy hh24:mi') moment, 16.8 measurement
FROM dual
SELECT id, moment, measurement, diff
FROM (SELECT id, moment, measurement,
moment - TO_DATE(TO_CHAR(moment, 'dd.mm.yyyy ') || '06:00', 'dd.mm.yyyy hh24:mi') diff
FROM t1
ORDER BY abs(diff) asc, SIGN(diff) desc;
C. -
How remove the values which are entered in filter attributes of VO
Hi,
On top of one VO we are performing search using bind variables.
To refine the search we have added filterable="true".
Now when we perform seach and then we have filtered using one column we got result and we proceeded.
When we come to this screen again when i perform search with the bindvariable and click on search then the previously applied filter is also getting applied
becuase the value in that filter is still there.
So How can i remove the value which is entered in filter attribute of the VO programatically.
Please help me.
Regards
Gayazwould this help you:
http://adfscopes.blogspot.com/2011/03/programatically-clearing-filter.html -
Bind Variable in SELECT statement and get the value in PL/SQL block
Hi All,
I would like pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
Please seee below
I want to get the below value
Expected result:
select distinct empno ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
100, HR
select distinct ename ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
TEST, HR
select distinct loc ,pr.dept from emp pr, dept ps where ps.dept like '%IT' and pr.empno =100
NYC, HR
Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
Please suggest
----- TABLE LIST
CREATE TABLE EMP(
EMPNO NUMBER,
ENAME VARCHAR2(255),
DEPT VARCHAR2(255),
LOC VARCHAR2(255)
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
COMMIT;
CREATE TABLE COLUMNAMES(
COLUMNAME VARCHAR2(255)
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
COMMIT;
CREATE TABLE DEPT(
DEPT VARCHAR2(255),
DNAME VARCHAR2(255)
INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
COMMIT;
PL/SQL BLOCK
DECLARE
TYPE EMPCurTyp IS REF CURSOR;
v_EMP_cursor EMPCurTyp;
l_col_val EMP.ENAME%type;
l_ENAME_val EMP.ENAME%type;
l_col_ddl varchar2(4000);
l_col_name varchar2(60);
l_tab_name varchar2(60);
l_empno number ;
b_l_col_name VARCHAR2(255);
b_l_empno NUMBER;
begin
for rec00 in (
select EMPNO aa from EMP
loop
l_empno := rec00.aa;
for rec in (select COLUMNAME as column_name from columnames
loop
l_col_name := rec.column_name;
begin
l_col_val :=null;
l_col_ddl := 'select distinct :b_l_col_name ,pr.dept ' ||' from emp pr, dept ps where ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
dbms_output.put_line('DDL ...'||l_col_ddl);
OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
LOOP
l_col_val :=null;
FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
EXIT WHEN v_EMP_cursor%NOTFOUND;
dbms_output.put_line('l_col_name='||l_col_name ||' empno ='||l_empno);
END LOOP;
CLOSE v_EMP_cursor;
END;
END LOOP;
END LOOP;
END;user1758353 wrote:
Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
However, the data structures are just that - structured. Logical.
Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model. -
How to select records in ALV using FM
Hi guys,
How to select records in ALV using FM. Not the OO method. Thx in advance!
KunhI
by using REUSE_ALV_FIELDCATALOUG_MERGE. Iys fill field catalouge table as per internal table description. Then use REUSE_ALV_GRID_DISPLAY for display ALV REPORT.
**Please reward suitable points***
With Regards
Navin Khedikar -
How do i record video on the new iMovie on my mac
how do i record video on the new iMovie on my mac
Hey baseballgod44,
Great question! The following article outlines how to record video with the FaceTime HD Camera in iMovie (2013):
iMovie (2013): Record video with the FaceTime HD camera
http://support.apple.com/kb/PH14675
Record live video directly into iMovie
1. Do one of the following:
- To record using the built-in camera: Click the Import button in the toolbar.
- To record using an external iSight camera: Connect the iSight camera to your computer with a FireWire cable, and click the Import button in the toolbar.
2. In the Cameras section of the Import window sidebar, select the camera you want to import from.
A live video image from the camera appears in the Import window.
3. Do one of the following:
- To choose an existing event to contain the video: Choose the event from the “Import to” pop-up menu at the top of the Import window.
- To create a new event to contain the video: Choose New Event from the “Import to” pop-up menu, type a name for the new event, and press Return.
Thanks,
Matt M. -
How to select alternate entries from the database table
Hi Experts,
can u help me, how to select alternate entries from the database table.
ThanksAs there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
What table do you have in mind, what data does it hold, and why do you want alternate records?
matt -
Crystal Report Formula to select Record of only MAX Value
hi Everyone,
i need a simple crystal report formula to select one department whose recived quantity Maximum.
for example:
itemcode dscription departmen op recived issue
1 a ab 2 2 2
1 a bb 0 2 2
1 a bc 4 8 2
1 a cc 2 2 2
i group by item the item show just once but i want a formula to show one department who's recived quantity is maximum.i suppress the detail section.and just show the group footer/
itemcode dscription departmen op recived issue
1 a bc 8 14 8Thanks
Re: Crystal Report Formula to select Record of only MAX Value
Abhilash Kumar -
How to block an invoice if the value of a post is zero?
Hello,
In the rules of copy we use the field " Pricing type " with the value " C = Copy manual pricing elements and redetermine the others ".
The order is complete and the price of the post is not equal to zero.
During the invoicing the system makes a new search for the prices in the tables of conditions.
If the condition does not exist in the date of invoice the post takes the zero value.
How to block an invoice if the value of a post is zero?
There is no incompleteness procedure for the invoice.
The value of the post is the result of several conditions and we cannot make them obligatory.
Who already has to meet this problem with the recalcul of the price in the invoicing?
Best regards
Frédéric Blaise
e-Kenz S.A.
LuxembourgHi,
It is not the total invoice which is equal to zero but only one post.
As I explained it at first the problem is the following one:
In the rules of copy we use the field " Pricing type " with the value " C = Copy manual pricing elements and redetermine the others ".
he order is complete and the price of the post is not equal to zero.
+During the invoicing the system makes a new search for the prices in the tables of conditions.
If the condition does not exist in the date of invoice the post takes the zero value.
I look for a solution to block the creation of the invoice if a post only is equal to zero after the updating of the prices.
Thanks
Frédéric -
How to find out the values which are assigned in authority group
Hi to all
Please tell me where can I find out the values which are assigned in authority object according to roles.
for ex :
Changed Customer: Account Authorization F_KNA1_BED
Changed Customer: Account Authorization T-DR50175601
Activity 01, 02, 03, 08 ACTVT
Authorization Group 5100 BRGRU
F_KNA1_BED is the authority object , assigned to one user.
He can access the authorization group 5100. I want to check that value in my program.
How ?
Where it is stored.
Please help me....
Regards
Anubhav GuptaHi Anubhav,
Please use this FM "SUSR_USER_AUTH_FOR_OBJ_GET" and pass the object name in it . You would get the values for that particular object.
Thanks
Nitin Sachdeva -
How can i copy and referencing the value of a sub-total of a category into another cell?
How can i copy and referencing the value of a sub-total of a category into another cell?
Cells in Category rows 'exist' only when those categories are inserted using the Reorganize table. Those cells cannot be referenced from other cells.
If you want a category summed, you will need to do that in a cell that is still visible when the table is not sorted into categorie using the Reorganize pane. The function to use is SUMIF. You can find information regarding SUMIF (and SUMIFS) in the iWork Formulas and Functions User Gude. The guide may be downloaded using the link in the Help menu in Numbers '09.
Regards,
Barry -
How to calculate a date in the future and set it as field value?
I'm trying to set the value of a read-only field to a date and time 72 hours from the current date and time. Here's how I'm doing it now:
var futureInMilliseconds = new Date().getTime() + 259200000; // current date and time + 72 hours in milliseconds
field.value = new Date(futureInMilliseconds);
The field is formatted as "m/d/yyyy h:MM tt". When I test this in the debugger I see it listing the correct date and time in the future, but the value applied to the field is always the current date and time. So, I'm having a difficult time getting this to work for something that should be fairly straight forward and simple. I'd appreciate any suggestions.What is the "field" object?
What happen when you use "event" for the object and not "field"?
Even if this script is placed at the document level or any other location, it is still a calculation. It just not a field Custom Calculation Script. You are adding one value to another to get a new value. -
How to select Multiple items in the dvt:pivotfilterbar?
How to select Multiple items in the filters in the dvt:pivotfilterbar?
To select multiple media and other files, it's not possible. You can do so in messages as directed.
To select multiple files, connect to your PC and select them.
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
4. Guide to Unlocking your BlackBerry & Unlock Codes
Join our BBM Channels (Beta)
BlackBerry Support Forums Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code
Maybe you are looking for
-
Select Query in Crystal Report
Dear all, I have a report to be developed in which i have to fire more than 2 select quires. I am adding this quires in "Add Command" window, it doesn't give any error but gives output of first query only. I have tried to use multiple commands in rep
-
Does anyone know how I can convert .SWF files to either Quicktime or .AVI? Thanks, as always.
-
The firefox window pops up saying it is an untrusted site. it even did it when I started this inquiry.
-
Unable to ascertain the compatibility of itunes
i want to copy myt data to my iPhone via itools the error occured is unable to ascertain the compatibility of itunes my itools and itunes both are updated. please help thank you
-
I managed to have a working sample using the Gyroscope native extension. I followed these steps: 1) Downloaded the extension 2) Added the ANE file to the library path into Flash Professional CS 5.5 3) Coded as shown in the extensions documentation 4)