.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 can I create an increasing rate column

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :Sql Server
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!

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.


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




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

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!

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


 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" />


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.


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

How do I create a stacked column chart over yrly/mo series/category?




I would like my output to look like this:

2009          2010


|__c__|    | __b__|    

|__b _|   |   a      |

|   a   |   | _____|


where both of the stacked bars represent data for the month of January such that each month would have it's own two years worth of stacked bar data...please help.

How to create a BCS (Business Conectivity Services) column programatically?



I have a SP2007 app that adds a BDC column to a list like this:

  string xml = "<Field Type=\"BusinessData\" DisplayName=\"Product\" ...>"; 
  SPField fld = list.fields.AddFieldAsXml(xml, true, addOptions);

  BusinessDataField bdcField = fld as BusinessDataField;
  bdcField.SystemInstanceName = instance;
  bdcField.EntityName =         entity;
  bdcField.BdcFieldName =       bdcFldName;
  bdcField.Profile =            profile;
  bdcField.HasActions =         hasActions;


How do I do it in SP 2010? Class BusinessDataField  does not exist in Microsoft.SharePoint.Portal.WebControls,
and I found no samples.

Thanks in advance


create a new table column with data...


I have created a web project using asp.net and visual web developer 2008.  On my local project I created a new column in one of my MS SQL data tables and populated it with data.  How would I create a sql script of the new column and data?  I want to insert this into my live database on Godaddy? 



how to create calculated column with gridview boundfield?


Hi Friends.....

can you guide me how to create calculated column with gridview boundfield?

Thanks in advance.........

Datagrid create column - codebehind question


How do I contruct below text column from code behind?
 it has extra "filter" option where filer is xmlns:filter="clr-namespace:DataGridFilterLibrary;assembly=DataGridFilterLibrary"

<toolkit:DataGridTextColumn Binding="{Binding Path=Email}"
Header="Email (Case Sensitive Search)"/>


Add a new column or create a separate table (1billion recs)


One of our production table contains about 1 billion records.

There is a need to remove one column and add 2 new columns, then update them.


Should I create alter scripts for this and update the table with new values?

or create a new table and load the data from old to new, drop the 1st table and rename the 2nd one.


What should be the approach?


Null Value/ create new column issue in SQL


Hi, I have a database with year, month, area1, area2.  Area2 has null values in them, and i want to create a 3rd column that takes area2 value as default, but if there is a null value in the column, then it looks at taking the value from area1. 

The Third column is the kind of column that i would like to produce, but i am not sure how to write it.

See example below:

year month area1 area2
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