.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

Want to. SELECT Field_1 AS [Field_2/@Value] from Table_1 FOR XML PATH (N'), TYPE . where Field_2 i

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :Sql Server
<!-- /* Font Definitions */ @font-face {font-family:"MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-alt:"MS ??"; mso-font-charset:128; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:"\@MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-charset:128; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; line-height:120%; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Calibri; mso-fareast-font-family:"MS Mincho"; mso-bidi-font-family:"Times New Roman"; mso-fareast-language:JA; mso-bidi-language:AR-SA;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> I'd like to dynamically specify an element name (Field_2) in my select statement ala: SELECT Field_1 AS [Field_2 /@Value] FROM Table_1 FOR XML PATH (N’’), TYPE&

View Complete Post

More Related Resource Links

Want to. SELECT Field_1 AS [Field_2/@Value] from Table_1 FOR XML PATH (N'), TYPE . where Field_2 i

I'd like to dynamically specify an element name (Field_2) in my select statement ala: SELECT Field_1 AS [Field_2 /@Value] FROM Table_1 FOR XML PATH (N’’), TYPE  where both fields are in Table_1   Is there a way to do this?   Thanks!   Here's an example:   <Facet Name="ABS Offset">     <Number Value="5.307" />   </Facet>   <Facet Name="Assembly Type">     <String Value="PreSet Hub Assembly" />   </Facet>

Cannot select 'SQL Server Compact Edition' from Server Type drop down

I have seen this issue addressed for SQL Server 2005 but not 2008. I have installed these components:SQL Server 2008 (Browser, Management Objects, Native Client, Policies and Setup Support Files)SQL Server Compact 3.5 (for Devies, Server Tools and SP1)In the SQL Server Management Studio, on the Connect to Server dialog, the "Server Type" drop down list is disabled and "Database engine" is the default. Does anyone know what I need to do to make "SQL Server Compact Edition" a choice in the "Server Type" drop down list?

Select right type of replication

Hi. I have this scenario: There exists one database(about 70GB). At the same time, this database will be attached to the two SQL Servers 2005(x64), Standard editions. These servers are a few hundred km far away from each other. Different applications will connect each SQL Server, these applications will modify data in this databases. It means that during this time the databases will have some different data. We need to replicate these changes to these databases on both SQL Servers. So with this replication the databases will have the same data. The data should be visible as soon as possible, so I am thinking about Transaction replication. Is it possible, please, to do it with Transactional replication? What is your opinion on how to solve this? I have tried this: Server A as a publisher of database X and Server B as a subscriber of database X. This worked fine. Server B as a publisher of database X and Server A as a subscriber of database X. I was not able to do this operation. There was an error: I cannot drop a table …. because it is being used for replication. So I suppose SQL Server A cannot apply the first synchronization snapshot. We cannot use Updatable Subscriptions for Transactional Replication because the structure of the tables cannot be changed. We cannot use Peer-to-Peer Transactional Replication because it is only in Enterprise version. Thank you ve

Sharepoint export to spreadsheet gives two extra columns in excel 2007 named as type and path, is th

When i export a list in excel 2007, it creates two extra columns named as type and path. At the same time this behaviour is not exhibited in office 2000. Is there any way to remove these two columns without using code ? Is there any configuration settings required for this, to remove it on the fly ? Thanks Ravish Verma

How Can I Repeat Elements in a 'For XML PATH' SELECT Statement?


I am trying the XML functions for the first time.  I want the phone element to repeat for home and cell phones but when I run the statement below, I get the error message, "Attribute-centric column 'Employee/contact/phone/@type' must not come after a non-attribute-centric sibling in XML hierarchy in FOR XML PATH".   Does anyone have a fix for this please?

SELECT 'Jon Stewart'       as "Employee/name",
       'home'              as "Employee/contact/phone/@type",
       '(555) 555-1212'    as "Employee/contact/phone",
       'cell'              as "Employee/contact/phone/@type",
       '(555) 555-1212'    as "Employee/contact/phone",
       '123 Main Street'   as "Employee/contact/street",

Input type file-: Not getting full path in mozilla


Hi All

I am using Input type = File to get a file from Disk.

<input type=file id="ipFile">

But when i get the value of this i get a file name in Mozilla where as a complete path with file name in I.E.


In I.E. -: D:\bkp\css.txt

In Mozilla -: css.txt

I want to get the Full path in Mozilla too. 

Please help and advice

SQL Select problem with bit data type


I have an odd situation.  I wish to select the value of a bit field in my MS SQL query.  I want to know if it is true or false (1 or 0), but my query seems to somehow converting all the responses (true or false) to the letter 'A'.  I want to know what the bit value is: true or false.

Here is the query:

SELECT dbo.roles.pk_role_id, 
FROM   dbo.members 
       INNER JOIN dbo.roles 
         ON dbo.members.pk_id = dbo.roles.fk_member_id 
       INNER JOIN dbo.teams 
         ON dbo.roles.fk_teambar_number = dbo.teams.pk_id 
WHERE  ( dbo.roles.fk_teambar_number = @FK_TEAMBAR_NUMBER ) 
       AND ( dbo.roles.TYPE = 'Player' )  

Why is it converting all TEAMS.ACTIVE date to the letter 'A' for both true and false ???  I bind the results to a gridview and both true and false are listed as an 'A', and I get the same thing where I run the query in my GoDaddy query analyzer.  Does anyone have an idea how to fix this?

Type in first few characters to select items in a large list quicker

is there a way that you can type in the first few characters of an item in a dropdown box eg if you type ‘rad’ in the dropdown box it will take you to the first item starting with ‘rad’.

Is it possible that you could type in rad to get you to radiator for example?

PRINT vs SELECT of a real type in SQL Management Studio



I know real approximate the value etc. The question from the sample below is why a select in the mangement studio dont use the "nice"/"correct" value like the print function. I tested and for example Reporting Services is clever enouth to use the "correct value".

The problem is that sometimes one want to write a quick manual query and move the output to xls etc.


DECLARE @ConversionFactor decimal(18,10)
DECLARE @Limit real
DECLARE @Report_Meas_Result real

SET @ConversionFactor = 1000
SET @BLDVALUE = '<0.0002'
SET @Limit = cast(RIGHT(@BLDVALUE, LEN(@BLDVALUE) - 1) as real)
SET @Report_Meas_Result = @Limit/2 

TreeSelector : playing with generics and type inference

create a generic way to define a selection starting from a tree of objects, the most simpler way as possible.

Let's start with the beginning...
Here is a very simple little interface defining a node of the tree, basically, a value and the references to the child nodes.

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

UnTyped DataSets and Strongly Type DataSets

We all are use datasets as a means of carrier of data from one layer to another. Most of the time we are using weakly typed datasets. In this article I will explain the differences between weakly typed datasets and strongly type datasets

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Gmail style multiple Sign-in type combo...is it possible in asp.net?


I am developing a multi-company application and want my users to give the functionality like the following to switch companies.


Is this possible? then how?

Please help


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.

Type or namespace error.


A couple of days ago I started getting an unusual behavior when compiling Website projects. I have referenced class libraries added to my bin folder that are also correctely referenced in using statements in my aspx.cs code behind. When I compile, I get the 

Error 4 The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?) C:\Dev\Fiscal_Portal\Implementation\FMS Portal Site_new\App_Code\BLL\DataTables.cs 1 7 C:\...\FMS Portal Site_new\

The type or namespace name 'CommonClassLibrary' could not be found (are you missing a using directive or an assembly reference?)

error message that would typically be received when the dll has not been added as a reference or added in a using statement.

I can eliminate the error by adding an


Bug: Does not change column type from nvarchar to ntext


Scenario: If you create a table with a column of type nvarchar, populate it with some content and try to modify it using the WebMatrix editor, from nvarchar to ntext, it does not display any error message or warning that this is not possible. It silently saves and reverts the change, back to nvarchar. Wasted some hours on this issue as I thought my column was ntext, but in fact was still nvarchar.

Expected behavior: It should change to ntext, or if SQL CE doesn't support that, it should notify the user that no change was applied.

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