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


Post New Web Links

sql convert vertical table to horizontal (deep to wide)

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :Sql Server
 
Hi I have 2 tables, where one holds Name and address information in a wide format, second table is a deep version where i have the records with field names (i.e. Date Of Birth) in the value and then another field with the actual value. I need to merge both tables together to create a new 3rd table and have everything in a wide format, so name and address for one record plus another new column with Date of Birth, so in the end i would just have one row for a person. i am using sql 2008, i dont have any examples to show, which makes it difficult to explain. a visual example would be table 1 id   name  address1      address2  postalcode 100 john    1 anystreet  anywhere  125254 table 2 id  fieldname  fieldvalue 100 dateofbirth  1 jan 1900 100 age         10 100 mobile     123456789 new table should look like table 3 id   name  address1      address2  postalcode   dateofbirth  age  mobile 100 john    1 anystreet  anywhere  125254      1 jan 1900    10   123456789 i have a very large dataset so need something generic and fast as there are lots of different field names so i would need to add th


View Complete Post


More Related Resource Links

Dataset has one field, populate a table 2 columns wide n rows deep

  

Hello,

A dataset returns a single field of child names, instead of presenting this as a single column table, I would like it to be multi column.

Dataset returns:

Child1
Child2
Child3
Child4
Child5

I would like to display it as:

Child1 Child2 
Child3 Child4
Child5

 


horizontal navigation menu instead of vertical

  
Hello I'm a newbie and using the internet/publication site type. Is there a simple way to have the Navigation (menu) oriented in a horizontal with dropdown menus instead of vertical? It would also be nice if the horizontal navigation wouldn't not scroll with the rest of the page. Thanks! Matt==GP Blog== http://dynamicssmallbusiness.blogspot.com/ ==Free GP Addons/Customizations/Tips== http://landiscomputer.com/offer/1010_GP_Newsletter.htm ==GP Tweets== http://twitter.com/search?q=%23dyngp#search?q=%23dyngp

Different behavior of horizontal and vertical GridSplitter

  
I'm trying to learn WPF. While it does appear to be quite powerful and flexible, some things are also rather confusing. The GridSplitter is my current headsplitter... Take a look at this XAML: <Grid> <Grid.RowDefinitions> <RowDefinition MinHeight="50"/> <RowDefinition Height="Auto" /> <RowDefinition MinHeight="50" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition MinWidth="50"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition MinWidth="50"></ColumnDefinition> </Grid.ColumnDefinitions> <Button Grid.Row="0" Grid.Column="0" Margin="2">Top Left</Button> <Button Grid.Row="0" Grid.Column="2" Margin="2">Top Right</Button> <Button Grid.Row="2" Grid.Column="0" Margin="2">Bottom Left</Button> <Button Grid.Row="2" Grid.Column="2" Margin="2">Bottom Right</Button> <!-- <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" Width="3" HorizontalAlignment="Center" /> --> <GridSplitter Grid.Row="1" Gri

Disable horizontal and/or vertical scrollbars on ReportViewer Webpart

  

Hello everybody,

I have set up SSRS 2008 and SharePoint Foundation 2010 and try to build a website showing all kind of reports. But I do have problems to control the appearance of scrollbars in the webpart.

To make it easier to explain I created a report where all sizes (Page size, Interactive and Text body) have the similar size (width: 100mm and height: 50mm).

Next I made an empty Wiki Site with single column layout and inserted a Reportviewer Webpart based on the generated report. I set the height to 70mm and the width to 120mm.

Here is the result: http://img213.imageshack.us/img

convert string to int before updating database table?

  

I have a form in which I display data from a database table, change the data and then update the database table. The form consists of textboxes, so all data displayed in the form is string. However - one data is int in the database table (the rest is varchar), so I need to convert it from string to int when I update the database table. How do I do it?


protected void SaveProd_Click(object sender, EventArgs e)
    {
        string BildID = TextBoxProdPictID.Text;
        string namn = TextBoxProdName.Text;
        string kategori = TextBoxProdCategory.Text;
        string stl = TextBoxProdSize.Text;
        string pris = TextBoxProdPrice.Text;
        string iLager = TextBoxProdNumberOf.Text; //this is int in the database table

        SqlConnection conn = new SqlConnection(config);
      //  conn.Open();
        string sql = "UPDATE Produkter SET kategori ='" + kategori + "', namn ='" + namn + "', stl ='" + stl + "', pris ='" + pris + "', iLager ='" + iLager + "' WHERE ID ='" + ID + "'";
        SqlCommand comm = new SqlCommand(sql, conn);//Conversion failed when converting the varchar value '__Page' to data type int.
        SqlDataReader dr = comm.ExecuteReader(); 

        //message
        //clear t

Vertical align table cells via SharePoint UI

  

Hi,

Is there anyway to vertical align table cells via the sharepoint 2010 WSIWYG editor? From what I can tell, you have to go into the html to do this, but you can't really tell end users to do this, especially for something that's quite a common request. Is there a way that i'm unaware of?

btw the main place where we need this ability is while using the PublishingWebControls RichHtmlField control.

Cheers,


how to table convert to simple div using jquery Ajex,.net

  

My Input Field
<table id="ritu"> <tr><td> Name</td> Rituranjan<td></tr> <tr><td> Father Name</td> <td>B.M.Gupta</td></tr> <tr><td> Age</td>20 <td><td>Sex<td>male<td></tr> </table> My Output is Name=Rituranjan Father name =B.M.Gupta Age=20 Sex=male



convert query to derived table

  

I have the query like that:

SELECT orderid, orderdate, custid, empid,
		  ROW_NUMBER() OVER (PARTITION BY orderdate ORDER BY orderid) rownum
FROM [TestSQL].[Sales].[Orders]

How can I do it with derived table?

 

 


SQL 2008 Pivot using vertical and hortizonal format table

  

Hi

I have 2 tables, where one holds Name and address information in a wide format, second table is a deep version where i have the records with field names (i.e. Date Of Birth) in the value and then another field with the actual value.

I need to merge both tables together to create a new 3rd table and have everything in a wide format, so name and address for one record plus another new column with Date of Birth, so in the end i would just have one row for a person.

i am using sql 2008, i have a very large dataset so need something generic and fast as there are lots of different field names so i would need to add this to the new table as well. The number of fields is not consistent, so need to create this dynamicaly, I also need to run in small batches as the selection causes space issues.

declare @fieldNames varchar(max)
set @fieldNames = stuff((select distinct ',' + incomingfieldName from tmp_other for xml path('')),1,1,'')
declare @sql nvarchar(max)

declare @BatchSize int, @MaxID int, @Iterations int, @I int
set @BatchSize = 10000 -- 1K records at once
select @MaxID = max(Purn) from Tmp_Rank -- get maximum number
set @Iterations = ceiling(@MaxID/@BatchSize) -- this will give us number of iterations to perform.
print 'MaxID: ' + convert(varchar(10),@MaxID) + ' Batch Size:

How to convert Table to Image

  

Dears,

I want to conver a html table and its content to an image with the best quality, I have read some post that use url while I need direct way to do this. For example when I press the button a table in the same page convert to image and save in local machine. I run this application in win XP Prof

Thanks


how to get horizontal scrollbar for empty ListView which has headers that are too wide

  

Consider the following ListViews, both have a combined column width that is too large to fit.

  <ListView Height="100" Width="300">
    <ListView.View>
      <GridView>
        <GridViewColumn Width="120" Header="Date"

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Insert value using Table Value Functions

  
a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Using jQuery to Filter Table Rows

  
The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

RadioButton Groups, Table Rows And NamingContainers in asp.net

  
The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

RadioButton Groups, Table Rows And NamingContainers

  
(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

Building a 3-Tier App with Silverlight 3, .NET RIA Services, and Azure Table Storage

  
Silverlight 3, .NET RIA Services, and Windows Azure Services Platform makes a 3-tier Cloud application easier to build: Silverlight 3 as presentation tier, .NET RIA services as the business logic and data access tier, and Windows Azure Table as the data storage tier. The sample application in this article demonstrates the architecture with a simple Survey application with all these technologies working together from Windows Azure.
Categories: 
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