SQL Server :: Fetch Data From Xml In The Sql Query
Oct 26, 2010
i'm trying to fetch data from xml in the sql query.
DECLARE @xmlDelete xml
SET
@xmlDelete =
'<DocumentElement>
<row FSFF_FeesItemID="185" FSI_ID="104" />
<row FSFF_FeesItemID="187" FSI_ID="104" />
<row FSFF_FeesItemID="187" FSI_ID="105" />
</DocumentElement>'
;
WITH
r_set AS
(
SELECT
T1
.c1.value('(./FSFF_FeesItemID/text())[1]',
'int')
AS [id1]
,
T1
.c1.value('(./FSI_ID/text())[1]',
'int')
AS.......................................
View 2 Replies
Similar Messages:
Mar 27, 2011
I have two tables and following are the structure of both the tables
Tbale 1
Field1 Field2 Field3
d1 01 26/03/2011
d2 02 26/03/2011
d3 03 27/03/2011
Table2
Field1 Field2 Field3
01 6.15 14.25
02 7.30 16.25
03 6.00 18.25
My expected output when i search records by table1.field3 (say 26/03/2011)
Tbale 1
Table1.Field1 Table2.Field2 Table3.Field3 Table2.field2 Table2.Field3
d1 01 26/03/2011 6.15 14.25
d2 02 26/03/2011 7.30 16.25
d3 03 27/03/2011
Inorder to get the above result, what query should i write?
View 4 Replies
Jan 4, 2010
I am using following oracle query and using executescalar() to fetch data
sql = "select username from usermst where userid=2"
string getusername = command.executescalar();
But It is showing me error "System.NullReferenceException: Object reference not set to an instance of an object"
This error comes when there is no row exist in database for userid=2
View 4 Replies
Aug 16, 2010
I'm unable to fetch just one integer value using this LINQ-query. LINQ seems to return everything as IEnumerable but I don't want that. First query should return just one string value which is then used in another query. That one should return integer which is also return value for method:
public static long GetTableIdByTableName(string name)
{
var result = (from aTable in objScope.Extent<Table>()
where aTable.Name == name
select { aTable.Id });
return ???????????
}
View 1 Replies
Jan 13, 2011
Are there any ways in ASP.net to fetch data from the server without extending the session timeout? This needs to be done every few minutes without user interaction until the page is closed.
Additional context, as requested:
The pages in my webapp needs to poll the server every few minutes to check for a particular condition (emergency maintenance scheduled for 30 minutes time, in this instance). When the condition is true, the page will display a message to the user. When the condition is false, nothing needs to happen.
As I understand it, postbacks to the server reset the time until the session expires. We do not want the session to be extended/refreshed/reset/whatever the word is every time the page polls the server. I need a way to poll the server automatically without resetting the session timeout.
View 3 Replies
May 4, 2010
i want fetch data from temp table in sql server stored procedur like below code
[Code]....
primary key is of uniqueidentifier in dataTable
View 4 Replies
Apr 14, 2010
i have a database and database have 3 tables... i want the table data show in asp:table not in grid view....
like in frid view we a doing simple wizard mode to fetch data from database... But in my query i want show data in <asp:Table> ..
asp:TableCell>
<fetech
data from sql
server table>
[Code]....
View 2 Replies
Feb 18, 2010
To write a join query with or condition. It means a query has two inner join, here it is possible to fetch the records, if one inner join is true and other is false. I got a record when only two join conditions are true.
View 1 Replies
Dec 13, 2010
In oracle we can do this by using rowid.
select * from tableName where rowid = (select max(rowid) from tableName);
but i don't know equivalent of rowid in sql server.
View 8 Replies
Jan 22, 2011
I want to transfer the data from one server to another by sql query. I want query. I dont know how to write?
View 2 Replies
Mar 8, 2011
I have an aspx master/content page scenario. The parent page has an IFrame which points to a child.aspx. The child.aspx has a checkbox, On page_load of child.aspx, I want to show/hide the checkbox depending on the following logic:
- if the child.aspx is opened directly, then I have to show the checkbox.
- if the child.aspx is opened in the IFrame, then I have to hide the checkbox.
Basically, I want to check in child.aspx, if it contains a parent window then hide the checkbox control otherwise show it.I will prefer the show/hide code in codebehind in Page_load event as I have to execute some more logic depending on whether the it is opened from parent window or not.
Till now I did the following:
In child.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
<script language="javascript" type="text/javascript">
function DoesParentExists()[code].....
Using RegisterClientScriptBlock, I get error in JS. That the object hfDoesParentExist doesn't exist 'coz the control is not yet created. Right? I tried using RegisterStartupScript but in codebehind I always get null in hidden variable. I don't want to use the on button click or something like it. I need it on page_load event only.
View 2 Replies
Sep 2, 2010
I read some articles before posting to try and solve my issue but i didn't get anywhere,
Here is what i'm trying to do:
1) I have an excel sheet with 1 EntrantID column and the rest are numbers (these numbers refer to answer codes for certain questions),
So for example, my excel sheet looks something like:
ID --- a1 --- a2 --- a3 --- a4 --- a5 --- etc...
1 ---- 32 --- 55 --- 12 --- 121 -- 50---etc...
The goal is to traverse thru every row, and every column and according to a checking condition for the values of answers, i will add the number to one of two columns in another table, so for example, i will start traversing a1, i will check it's value which is 32, if 32 > 0 and 32 < 60, then i will add 32 to columnA in another table, else, i will add it to column B in that table, then i will move on to the next value, a2 which is 55, it's < 60 so i will 'add' it to that same columnA in that table..
At the end, my other table, the one with results should look like this:
PersonID --- columnA --- columnB
1 ------------ 32, 55, 12 --- 121, 50
Hope i didn't confuse things, i'm trying to explain as best as i can lol.
So what i did, i imported the excel sheet to sql server, and i looked up SQL language to see if i can do that thru SQL itself, and i couldn't find a way to traverse columns, so next, i started an ASP.NET project, connected to the DB and i drag/dropped the table in my page as a GridView, where i'm trying to traverse it so i can get the values, check them against the range, and insert them in relative column.
I tried something like this:
DataTable dt = new DataTable();
dt = (DataTable)GridView1.DataSource;
DataTable temp = new DataTable("MyTable");
for (int i=0; i < dt.Rows.Count-1; i++)
for (int k = 0; k < dt.Columns.Count-1; k++)
if ((int)dt.Rows[i][k] > 0 && (int)dt.Rows[i][k] < 50)
temp.Rows[i][k] = dt.Rows[i][k];
That is not working, and i'm unable to do it. basically, i don't know how to fetch the value inside each [row][column], and overall i don't know how i can do the required task.
View 5 Replies
Feb 17, 2011
how to fetch the details of SPace allocated to Database by query. I.e. i want to fetch the details of Space allocation (Total space allocated, used space and free space) via query.
Is their any solution to it? currently i have to manually go to the specific database's taskpad to read the values and write it in my report.
View 6 Replies
Aug 8, 2012
How i can download image from sql server and store in a folder?
View 1 Replies
Aug 29, 2013
I want to download Email attachments in to my asp.net website.
&
Read only unread Emails of mail id with use of pop3 or imap. with attachment.
View 1 Replies
Aug 16, 2012
I am not getting image from Sql Server Database.
Actually I placed a gridview in my project ,in that gridview I placed an images control in that gridview and I want to get the images from Sql DB to gridview.
View 1 Replies
May 17, 2010
By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.
View 10 Replies
Mar 2, 2011
I am trying to create statitics for game downloads and am having dificulty with a sub part of my query. the goup by command is not having the disired result and i think i have been looking at it too long to see what i am doing wrong. [Code]....
At the moment it is producing each result in many rows when only 4 rows should appear. its the download column that is doing it. needs to be sub queried or something to display total in relation to month,gameid,userid.
Month-download-GameID-UserID
1 1
1 1
1 1
1 1
View 2 Replies
Feb 1, 2011
I am trying to display this query result in an aspx page.
It is very slow in loading. Here is the query. The inner query inside the outer quesry is the problem.(Please see the underlined part in the query) - (If I remove that part it is very fast.)
select
top 500
--This column is the issue
,Governing_Class=( case when exists (select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.appid and tqc.class_code not in('8742' ,'8810','7380')
order by tqcm.premium_amt desc
)
then ( select top 1 tqc.class_code from
t_quote_class tqc
inner join t_quote_class_premium tqcm on tqc.class_code =tqcm.
class_code
where tqc.appid=pi.
appid
order by tqcm.premium_amt desc
)
......... From tables
View 7 Replies
Sep 3, 2010
I am a biggner in SQL DB . but i started a complicated and painfull work in SQL SERVER 2008. the problem convert Oracle hierarchical query to SQL query. the query
SELECT DISTINCT
LEVEL LVL,
SCH.NSCHEDULE_SL,
SCH.NSCHEDULE_SL_FM,
SCH.CSHED_CNAME
FROM FA_SCHEDULES SCH
WHERE LEVEL = 1
AND NSCHEDULE_SL_FM IS NULL
AND NBRANCH_SL = 2
CONNECT BY PRIOR SCH.NSCHEDULE_SL_FM = SCH.NSCHEDULE_SL
AND NBRANCH_SL = 2
View 1 Replies
Oct 13, 2010
How would I go about using my session data (ie username) for an SQL query to populate a dropbox? Here is what I have so far: SELECT Client_Name, Client_ID FROM Client WHERE (Client_Name LIKE '%@Client_Name%')
View 6 Replies
Dec 22, 2010
I am using SQL Server 2005. I have below table:
CompanyNo CompanyName Product
--------------------------------------------------------
100 C1 P11
100 C1 P12
100 C1 P13
200 C2 P21
200 C2 P22
etc...
And I want my sproc returns like...
CompanyData
------------------
100 - C1 - P11, P12, P13
200 - C2 - P21, P22
etc...
View 3 Replies
Jan 3, 2011
I have a table articles where i keep all the records of the articles wriiten by people online. Now i need to retrieve related articles based on the title i guess. I tried doing that using my stored procedures with the LIKE operator, but i guess that doesn't work because it does not take the whole string of the title and match with the ones in the database.
View 2 Replies
Mar 22, 2011
I have a stored procedure which is composed of three unions of three different views.
After the views are Unioned together, they are placed into a temporary table.
I need to somehow keep track of the data which comes from the second view, "View2".
Specifically I will later need to compare all Ages of people from the second view.
How can I do this? Here is an example of my unioned views
Select Name,Age,Gender from View1
UNION
Select Name,Age,Gender from View2
UNION
Select Name,Age,Gender from View3
View 4 Replies
Nov 4, 2010
i have tow query in one stored procedure
first query and the second one every of them return only value
i want to copy the result of tow values in a new row in new table
as i want to check on this tow values in ado.net
i want to get only this tow values as a row not first and secon query
only a row has result of first and second query results
[Code]....
View 3 Replies