.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

Please help. I need to create the element name by the value in that column (weekday) - FOR XML AUTO

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :Sql Server

 I need to create the element name by the value in that column (weekday).

I have query



if (OBJECT_ID ('tempdb..#dayWeek') is not null ) DROP TABLE #dayWeek;



([id] numeric(1), [name] varchar(15));


INSERT INTO #dayWeek ([id],[name]) VALUES (0, 'Monday');

INSERT INTO #dayWeek ([id],[name]) VALUES (1, 'Tuesday');

INSERT INTO #dayWeek ([id],[name]) VALUES (2, 'Wednesday');

INSERT INTO #dayWeek ([id],[name]) VALUES (3, 'Thustday');

INSERT INTO #dayWeek ([id],[name]) VALUES (4, 'Friday');

INSERT INTO #dayWeek ([id],[name]) VALUES (5, 'Saturday');

INSERT INTO #dayWeek ([id],[name]) VALUES (6, 'Sunday');


SELECT * FROM #dayWeek as day




which generates XML ...



<day id="0" name="Monday" />

<day id="1" name="Tuesday" />

<day id="2" name="Wednesday" />

<day id="3" name="Thustday" />

<day id="4" name="Friday" />

<day id="5" name="Saturday" />

<day id="6" name="Sunday" />


View Complete Post

More Related Resource Links

how to create index for a column


Hi Friends,

                       I need to create the index for a column and accessing that in sqlserver 2005. Please any one help me.


create Scheduled Task that auto send mails


hello every one

i bought a hosting plan that allows me to send about 500email/per hour

but my client wish to send about 2000 or 3000 email at a time

is there a way to split them and 500 email per a time automaticly without the need of reloging again every hour

my hosting plan doesn't allow me to create a sql jop or send mails via Sql Server.

any bright ideas ?

To create a custom control and type while creating a column


HI All,

i am creating a column in the list while creating a column i will have an option for choice field on selecting choice i can see dropdown, radiobutton, Checkbox to select and  can enter list of values. and on clicking ok i will get a column with radiobutton. in newform.aspx and also in editform.aspx

so i need to create the similar functionality with my custom radio button, so on create column i need to show my custom choce on selecting this i need to show my custom radiobutton  and  can enter list of values then on selecting it then click ok to create a column, in edit form and new form i need to show a radio buttons with values.

Thanks in advance




!!How can I create an increasing rate column

Here's the situation. Now I have a month group and a year group. And if I choose 2009 and 2010 two years, it will be like this: Month                  1                        2                          3                             4 Year            2009 | 2010         2009 | 2010           2009 | 2010             2009 | 2010 Count          ....    | .....           ........ I want to add a rate column after each month, and display the increasing rate  like :sum(count) on 2010.1/sum(count) on 2009.1+sum(count) on 2010.1 So how can I do this? Thanks!

How to create auto complete textbox

Hello I saw many examples from google. But there are nothing that the textbox is automatically completed by data from database. How can I do this. I like this example http://flux88.com/blog/jquery-auto-complete-text-box-with-asp-net-mvc/  but how can I modify it. 

Create list column, if column does not exist programmatically

Hi, I want to create a column in  the list programmatically. I tried this, and it created the column. But I would like to check if the list column already exist and if column does not exist, would like to create the column. How to check if a list column exists and if it does not exist, create the list column. I have used this code: [CODE] SPList MyList; MyList = currentweb.Lists[Constants.listname]; MyList.Fields.Add("FilesCount", SPFieldType.Number, false); MyList.DefaultView.ViewFields.Add("FilesCount"); MyList.DefaultView.Update(); [/CODE] Thank you

Create unique constraint on a column which has null values

Hi All, I have a table suppose 'Temp' having one of the column as 'ColA' which has some null values as well as non null values. Now i have a requirement to create a unique constraint on it. We have tried but couldnt do it.Apart from having a trigger on insert and update statements is there any other alternate. Can any one please help me on this. Thanks & Regards, Srikanth  

How to create nonclustered index which uses function on column?

Hi, Is there any way I can perform following. The ID column is of varchar type.   CREATE NONCLUSTERED INDEX idxID ON Table_1(CAST(ID AS BIGINT) );   Regards, Jigs

Auto Create Statistics - when does creation occur?

Hi. I've been asked to enable auto create statistics and auto update statistics on a production database that is suffering perfmormance problems. This seems a sensible move. However, I'm concerned about an inital performace hit when I turn auto create statistics on. When does the creation of statistics actually take place? Thanks.

The OlapInfo element at line 1, column 503 (namespace ) cannot appear under BackupLog. (Microsoft.An


I am getting this error that I can not find any references online.

Made a backup of SSAS db on one server, dumped .adf file to another server, tried to restore, getting:

TITLE: Microsoft SQL Server Management Studio

The OlapInfo element at line 1, column 503 (namespace ) cannot appear under BackupLog.



 Can it be because origin is R2 and target is not?

How to auto create (or Generate a script) which can create indexes on subscriber


In our scenario, subscriber and publishers have same tables and we want the indexes also to be same at all places..

How to auto create (or Generate a script) which can create indexes on subscriber which are already added on publisher.. Is there a auto way or is there any article somewhere which can help..


IMP : There might be a delay in posting replies due to time difference (GMT +2:00) and Friday's Holiday instead of Sunday.

Create Lookup Site Column based on External List (SharePoint 2010)


I've got an External List and I want to create a Site Column, which is Lookup to a column in my external list. If I tick any of the columns in 'Add a column to show each of these additional fields' and click OK i get the following error message:

[NullReferenceException: Object reference not set to an instance of an object.]
  Microsoft.SharePoint.SPBusinessDataField.IsInDefaultView() +58
  Microsoft.SharePoint.SPBusinessDataField.CreateSpFieldForBdcType(String bdcName, Boolean hidden, Boolean readOnly, Boolean idField, SPAddFieldOptions op) +809
  Microsoft.SharePoint.SPBusinessDataField.AddNeededSecondaryFields(String wssNames, String[] oldNames, String[] newNames, SPAddFieldOptions op) +315
  Microsoft.SharePoint.SPBusinessDataField.OnAdded(SPAddFieldOptions op) +240
  Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol) +759
  Microsoft.SharePoint.SPFieldCollection.Add(SPField field) +61
  Microsoft.SharePoint.ApplicationPages.FieldNewPage.Save() +513
  Microsoft.SharePoint.ApplicationPages.FieldNewPage.BtnOk_Click(Object sender, EventArgs e) +46
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +139

Gridview: How to create a column that will autogenerate the serial number of each row


Hi all,

I have a gridview and I want to autopopulate the serial number columns. For eg, the gridview has 10 rows. The user deleted the first row. I want the gridview serial number to automatically shift down by one. Ie., 10-->9, 9-->8 and so on.

Can this be done? Any help is much appreciated!

Auto Populating SharePoint List Columns based on value in one column

   I have a SharePoint List where I want to auto populate the value of some of the columns from another List based on a field "Title" which is primary & unique....
   I want to auto populate them when clicking "New Item"  and entering data... you put the "Title" value and it should match the Title value from another List and auto-populate some the columns...

   Please any idea would be highly appreciated....

Thanks in advance

Create column In Datalist On DataBound Event


Hi ,

 I have a condition on which i have to set the column of the datalist at run time.

IT may be 2,3 or 4 at run time.

How i do it. plz replay as soon as possible.

Is this possible that on the item bound event i set the html <tr><td>.

IF Yes Then How.


How to remove auto generated right blank column from the wpf datagrid?


i have already use this.


Create a new Column in SQL-Database-GridView


Hi everybody,

at this time I try to  connect to a SQL-Database with ASP.net.

That works very well with DataGrid, but I want to add a new Column to the DataGrid with the number of the database rows.

The column have to be the first Column of DataGrid.

I want to create a function (with for-loop) to count the number of the row of a DataGrid and write it into DataGrid's first Column.

The number of Rows gets the DataGrid by the SQL-Database.

The SQL Database shouldn't get a new Column. I just want to create the column dynamically.

How could I realize this ? 


Here you can see my SourceCode:

Dim connStr As String = "server=WU900136\SQLEXPRESS; database=GT; Trusted_Connection=yes"
    Dim conn As New SqlConnection(connStr)

    Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
    End Sub
    Private Dataset As DataSet

    Sub rData()
        'Read Data
        Dim sql As String = "SELECT Bezeichnung Thema, starttermin Beginn, endtermin Ende From GR_Seminare, Gr_Termine WHERE Gr_Seminare.SemId=Gr_Termine.SemId"
        Dim cmd As New SqlCommand(sql, conn)
        Dim DataReader As SqlDataReader
        DataReader = cmd.E
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