.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to convert into a single SELECT

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Sql Server
I need a query in single "SELECT" and capture all my 3 values into 3 different variables..please help. DECLARE @SourceSystem VARCHAR(100) DECLARE @TransactionType VARCHAR(100) DECLARE @TransactionVersion VARCHAR(100) DECLARE @StrXML XML SET @StrXML = '<PDI_Approval_Message> <Header> <SourceSystem Value="PDI/Workforce" Name="WF"></SourceSystem> <TransactionType Value="Timesheet" Name="WF TS"></TransactionType> <TransactionVersion Value="1.0.0" Name=""></TransactionVersion> <RequestType Value="Submit" Name="Action"></RequestType> <SubmittedOn Value="02/06/2010" Name=""></SubmittedOn> <SubmittedBy Value="AYAZ" Name="hannok"></SubmittedBy> </Header> </PDI_Approval_Message>' SELECT @SourceSystem = x.y.query('data(@Value)').value('.', 'VARCHAR(100)') FROM @StrXML.nodes('//PDI_Approval_Message/Header/SourceSystem') AS x(y) SELECT @TransactionType = x.y.query('data(@Value)').value('.', 'VARCHAR(100)') FROM @StrXML.nodes('//PDI_Approval_Message/Header/TransactionType') AS x(y) SELECT @TransactionVersion = x.y.query('data(@Value)').value('.', 'VARCHAR(100)&#

View Complete Post

More Related Resource Links

select of X items in a single field

Hi! I've a select like this:select fieldA,fieldBfrom tablebut fieldB must be a list of items of another table:something like this:select fieldA, (select itemA from table2 where idref = table.id) AS fieldB from tableI need to show in fieldB a list of items (X records) returned from my second SELECT with a "-" for separate X fieldsI should show in fielB this:itemA - itemB - item C - item Dis it possible?Thanks

Tricky SELECT query from a Single Table

Hi I have a 2 rows of data in a table as mentioned below   Table1             ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 NULL 40 NULL 20 4 9 2010 400 NULL 200 NULL  I need a SELECT query to get the output in a single row as ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 400 40 200 20 Could anybody help me in writing a query for this? Thanks

Convert IList to datatable Error "Only a single enumeration is supported by this IEnumerable."



I am working in WCF Data service, in client side i am returning result as IEnumerable as below.

IEnumerable<MTSR> SearchResult = context1.Execute<MTSR>(new Uri(url));

i am converting this enumerable to datatable as below.

public static DataTable ToDataTable<T>(IList<T> data)

            PropertyDescriptorCollection props =
            DataTable table = new DataTable();
            for (int i = 0; i < props.Count; i++)
                PropertyDescriptor prop = props[i];
                table.Columns.Add(prop.Name, prop.PropertyType);
            object[] values = new object[props

Convert/Cast Single to double inaccurate.


Whilst I have read some background on floating opint numbers not being able to accurately store numbers such as 0.1, I am not clear why converting from single to double is so inaccurate.

Converting a single 0.1 to a double 0.1 yeilds


But 0.1 can be represented in a double more accurately, even if not perfectly as


This stems from the single representation of 0.1 actually equating to 0.10000000149011600 in binary.

However, we know that the single has a particular level of precision.

I would like a conersion function that converts single 0.10000000 to double 0.1000000000000000.

I can appreciate that the standard conversion functions would need to still exist as real numbers for engineering would suffer less overall inaccuracies with the existing rounding functions.


One other question:

Can the convertsion be affected by the OS/framework/hardware or will it be consistent on different machines?  Are there any settings that can change the conversion behaviour?



how to merge two columns value into single column in sql select statement?


i have a query like this

SELECT     tblClientDocument_Base.Document_name, tblJobDocument_Base.Document_Name AS Document_name
FROM         tblClientDocument_Base JOIN
                      tblJobDocument_Base ON tblClientDocument_Base.Tenant_Id = tblJobDocument_Base.Tenant_Id

it returns

Document_name        Document_name

a                                   d

b                                   e

c                                    f

now i want to merge like this









plz help?

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

Application Architecture in Windows Forms 2.0-Single-MDI Applications

Consider an MDI application like Microsoft Excel; files opened from the file system (by double-clicking) are all opened as separate child windows within the parent Excel window.7 For the first instance of an MDI application to open a new child window to display the file that was passed to the second instance of the application, the second instance must be able to communicate with the initial instance.

Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

Select value in gridview


Hi, I am new to gridview. I want to make a gridview. Its row when selected should direct me to a specific .aspx page.Each row should direct to a different page. Should I use querystrings for this? Please suggest. Regards, ap.

is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site p


is it possible to convert whole visual studio 2008 web site project to visual studio 2010 web site project


my current project references




i have a very annoying iis problem

iis server stops working until app pool is recycled


i am hoping that new visual studio (net framework 4.0) may solve this very annoying unsolveable problem


merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

Convert excel file into xml


Hai, I have two columns with id,name in the excel sheet.I want to convert into xml file in the below format

<?xml version="1.0" encoding="utf-8"?>

<guide xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Boat id="1"> <name> Copper Kettle </name> </Boat> <Boat id="2"> <name> Copper Penny </name> </Boat> <Boat id="3"> <name> Copperhead </name> </Boat> <Boat id="4"> <name> Coppertone </name> </Boat> <Boat id="5"> <name> Copy Boy </name> </Boat> </guide>

suggest me with sample code in ASP.NET. Thanks


how To Insert the single quotes in sqlcommand in asp.net


Hi all

    i am developed on simple user registeration application in that i gave  address field .when i am trying to enter something like this (1st main,b'lore) but wont take while inserting.

my query is

sqlcommand cmd=new sqlcommand("insert into registeration_form(name,address)values('"+txtname.text+"','"+txt_address+"')",con);

how can i pass the  quotes also to my query please if any one know reply me.


G Dinakaran

convert SQL data to EDI 835 file


I was assigned to create a app to convert SQL data to EDI 835 file. (Electronic Data Interchange file for Health Care Claim Payment/Advice,  outbound process only).

Can someone help me where to start?

Convert WCF service to self hosting application


 I created project as a  WCF Service application and now according to recuriment that needs to be converted as a self hosting application

How can i do this?

Converting WCF service app to Self hosting app?

How to Convert HTML to Image


 HI all,

I was struggling for the process/code to convert html to image. Please suggest any tutorials for this. And also any code help greatly appreciated.


thanks and regards,



convert jpeg to tiff


Hi all,

I need to comvert jpeg to tiff using c#.net

I have achieved this but problem is image size is increasing drastically. eg: 25 kb of jpeg image is converted to 650 kb of tiff image.

What should be done to have the same image size as of original or atleast double the image size as of original.

Please suggest me. Thanks in advance.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend