SQL Server :: Selecting A Percent Of A Table And Similar Records?

Oct 19, 2010

I have a piece of sql code that selects the top 10% of a table. See below a sample of the database table

And this is my code

[Code]....

So what this code does is add up all the points in the points table, (also works out what percentage of the points each user has) and then displays the top 10%, which in this case will give me "John" and "Dave"

So what I need the sql to do is check if any other records in that table have the same number of points ast the last selected record, and to select it to.

View 3 Replies


Similar Messages:

SQL Server :: Selecting Records Within A Week?

Sep 26, 2010

i try to use select statement to select records within a week from orderdate. like,

"select * from order where orderdate <= DATEADD(day,7,orderdate)";

correct me if wrong.

View 3 Replies

SQL Server :: Vastly Different Performance Of Table Update On Similar Machines?

Oct 21, 2010

Two machines. One a little faster than the other. The slow one runs windows xp, visual webdeveloper express 2010, sql server 2008. The fast one runs windows server 2008, visual wev developer express 2010, sql server 2008.The code in queston involves an automatically generated update function in one of the table adapters, called 'adapter'. Our C# code generates a data table called 'table', with which we update our 'datatable' in the table adapter.

The table has about 100 entries.We then update our datatable in the .xsd file by calling.

int rowsaffected = adapater.Update(table);//this is the line that takes long on fast computer return rowsaffected > 0;//since function returns a bool On the slow machine this line of code takes a few milliseconds.One the fast machine it takes 5 seconds.These results are consistent. It has nothing to do with one machine being busy, the other idle.

What could be the reason and how could it be solved? How can the same code, on the same platform, on a faster machine take 500 times longer than on a slower machine?

View 6 Replies

C# - Selecting Data From SQL Server Table According To Month?

Mar 31, 2010

I have to come up with a way to get data from a SQL server table given it's month

There's a smalldatetime type field called "date" in the "events" table and a field from it looks like this:

29/01/2003 17:00:00

It should be one among those that appear in the gridview when I select jan/03 in a given DropDownList control in ASP.NET.

What would be the best way to do this? Assuming I only want to go as long as 10 years to the past, wouldn't making a dictionary be a good way?

How do I change it so the top month is always the current, and each month another options appeaars in the dropdown ?

It should be a common issue, so that shall not be a trick, but I want a good and clean way of doing this, and (since I'm new to asp.net) I myself would come up with something messy after a long time trying.

So what I want is:

1) Select

2) Best way of populating DropDownList (with the current month always at the top)

3) Best way to bind the DropDownList user-friendly way of writing months to the select query-friendly way of writing datetimes

Info: ASP.NET, (C# or VB.NET), SQL Server 2005

View 4 Replies

SQL Server :: Adding A Bunch Of New Records To The English Table / Repeating The Data Entry Into The Spanish Table

Oct 29, 2010

I have two tables for storing language translations - tblEN and tblES. They have the same structure which is nvcEnglish and nvcLocal - both nVarChar fields.

In nvcLocal of the Spanish table, I enter the Spanish translations of words and phrases used within my app. Problem is, when I add a bunch of new records to the English table I also have to go in and repeat the data entry into the Spanish table. I am wondering if there is a way to import the newly added records into the Spanish table using Transact SQL?The plain language query would be something like:

If the data in tblEN.nvcEnglish does not exist in tblES.nvcEnglish then insert a new row into tblES with the values from tblEN

View 5 Replies

MVC :: How To Make Loud Similar Item When Selecting An Item

Feb 2, 2011

I'm trying to built in my web site the possibility to loud equal fields in the "select" page(when the user select item , I would like items that are related data in the "name column"ill be fire hopefully I'm clear That I have tried doing was in my repository I have written:

[Code]...

View 10 Replies

SQL Server :: How To Remove Records From A Table After Certain Days

Oct 25, 2010

I have records that were inserted into a sql server 2005 table using a stored procedure. I now need to remove or delete these records. The only problem is that the table does not contain a relevant column to define in my where clause when using delete command.

Is there any way I can identify these records for deletion.

View 4 Replies

SQL Server :: How To Upload New Records On Access Table

Nov 9, 2010

i have xyz.mdf file on live server every day i want to upload records on it for that i m downloading that file , make a changes on it and upload it . which is very time consuming and not a good practice is there any tool or any simple code i can write to do this for life time.

for sql i know there is a tool sqlpublishwizard which generate a query from selected table and that we can run directly on live server query analyzer and we can get the new records.

View 1 Replies

SQL Server :: Group Table Records By Hour For The Last 24 Hours?

Oct 15, 2010

i have a table which records visits to a page, what i want to do is get a count of the last 24 hours and group the visits by the hour.

This is my table structure;

ID, ChannelNewsID, AddDate

This is what i did so far however it gives me both past and future records where as i want 24 hours previously starting from when the query was run. Here is what my query looks like;

[Code]....

View 7 Replies

SQL Server :: Inserting Records Into Table Which Is Dynamically Created?

Sep 16, 2010

I have created table into database dynamicaly,while inserting records into that dynamic table i faced problem.

The name "STD000001" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. this error occured.

I created dynamic table by ,

declare @STUDENT_Table varchar(50)
set @STUDENT_Table = [dbo].[GetStudentTable](@SchoolID)
exec (@cmd)
[code]....

this stored procedure.....

Should i give any permission while creating dynamic table.

View 7 Replies

SQL Server :: Selects Records From Some Tables And Insert Them In One Other Table?

Dec 14, 2010

I have a simple sql that selects records from some tables and insert them in one other table.This is what we need to do on a daily basis and we need to create a sql job for this.

View 3 Replies

ADO.NET :: Selecting Records Given With An Array Using Linq?

Aug 14, 2010

i have an array with id numbers (of the products) in it.

Like for example:

string[] productIds = { "5", "12", "2", "2" };

Now i want to select only the records that only have the id numbers from the array, is it possible?

View 7 Replies

Selecting Specific Records From Dropdown Box Based On Another

Jan 31, 2012

I am creating an application with html using vb as the back end. Microsoft Visual Studio is the application I am using.

My question: I have two drop down boxes...one called department, the other program. When a department is selected, I want the program dropdown to only display the programs that are associated with the department chosen. I have found several different codes to do this but nothing has worked so far.

View 6 Replies

SQL Server :: Change Data Capture Records The Changes Like Insert, Update, And Delete To A Table?

Oct 26, 2010

CDC or Change data capture is a new feature in SQL Server 2008, which is an ability to record changes to table data into another table without writing triggers or some other mechanism, Change data capture records the changes like insert, update, and delete to a table in SQL server.I have sql 2005 and I have created triggers and tables CDC to capture the data. everything functions good and the data is being updated in the _CDC tables. all i need to do now is to generate the updated data as a report (excel/html)- what should I do ......?i need to show only the updated columns when user selects the date periods ( Range between dates ) and the person name - i need to display any updated info about that person during that period. So this updated columns about this person should be displayed in excel formatted column wise.

View 2 Replies

How To Bind DataGrid To Display Only 25 Records Of A Table Having More Than 1000 Records

May 31, 2010

I have a datagrid control which is bound to a table which containing more than 1000 records. And i want to show only 25 records once a time. I have used paging in datagrid. But each time the next page index is set, query is fired again. This takes lots of time. So what is the easiest way to bound data in this case to improve performance.

View 3 Replies

SQL Server :: Script To Insert Records From One Table Into The Other Times Original Tables Count Field Value?

Jan 28, 2011

I have 2 table's

Table 1: Daily_item

Fields: Key_Guid Drescription Count

1 test 3

3 new item 2

I want to insert records form table 1 into table 2 but using the count field to duplicate the Key_guid record the new table.

New table example:

Table 2

Key_guid

1

1

1

3

3

View 5 Replies

C# - Build A Html Table / Gridview Similar To Windows Explorer From A Database?

Jan 5, 2011

I've got a database that looks like this:

ID Name ParentID
1 1 0
2 1A 1
3 1B 1
4 1C 1
5 2 0
6 2A 5
7 2B 5
8 2B1 7
9 2B2 7
10 2B3 7

ParentID points to the ID field so that ID 2 is the child of ID 1.

Unfortunately, the order of the db elements is not guaranteed but what I'd like to do is have the information displayed sort of like in windows explorer with the children directly underneath the parents.

I've done something similar in the past with nested gridviews (ugh!), but it didn't point to itself and I knew how many children (additional db tables) there would be in advance. I'm basically trying to re-create that setup but make it much more flexible by making it point to itself.

Pseudo Coding I'd do something like:

Setup the html table and table headers Go through the DB from the top and search for the row with ParentID = 0 Add that row to the table Go through the db and find the row where ParentID = ID of Step 2)Add that row to the table Recursive magic go back to 4 Keep going deeper inception style ^^ Recursive magic go back to 2

I just have no idea how to even begin doing something like this!

This has nothing to do with my problem, but so you know where I'm going with this: after I get the table/gridview setup in the correct order, I plan on using jquery to hide all the non 0 parentID rows and make the rows clickable so that the child rows expand out underneath the parent row.

View 1 Replies

Data Controls :: Filter Records GridView By Selecting Column Name From DropDownList And Search Term From TextBox

May 22, 2013

need to get selected value from dropdownlist,textbox and bind in grid

View 1 Replies

Data Controls :: Filter Records GridView By Selecting Column Name From Radio Button List And Search Term From Text Box

Jun 23, 2013

I have a form where i want to view all columns from a table.I have a textbox and differeent radio button having values of each column.On click of button.I want to view all the columns as per selected row/rows from value given

View 1 Replies

Access :: Append To Table 'a' From Table 'b' Where Lastupdate = Date() Returns No Records?

Nov 18, 2010

I have an Access 2010 DB that I have a table of RAW data in. In my scenero when table 'a' has been populated all the rows with the updatedate of Now() get moved to another table... the SQL is like this...

[Code]....

As you can see it is a very simple query but it does NOT return any rows. There are actually 404 rows with todays date in teh Append_Date column.

I am stumped as to why it does not return rows?

View 1 Replies

ADO.NET :: Selecting Table From A Dropdown Menu?

Feb 5, 2011

I was wondering if ther is a Way to select a table name from a DropDown Menu and then dispaly the data in say a GridView?

For Example;

In PHP you can post a Value to a Veriable and Put that Veriable into a SQL Statement.

"SELECT * FROM '.$VAR.'" would be the statment used to return the data.

I was wondering if there was a similar way to dot his. Currently I have a different page for each table with other dropdown menus to select other options, or would continuing to do it like i have just stated be better?

View 5 Replies

MVC :: Selecting And Inserting Dropdownlist Value In To Table?

Mar 31, 2010

I have a table MemberProfile with columns FirstName, LastName, Gender and ComplexionCode.here iam displaying complexioncode as a dropdownlist with values fair, very fair, brown and when user selects a value I want to insert that in to table

I have creted a class( LookUpCodes) and written following code

public static IEnumerable<ComplexionCode> ComplexionCodes
{
get

[code]...

now when I click the button FirstName, LastName Gender are inserting in to the table. only Dropdownlist( ComplexionCode ) value is not inserting.

View 1 Replies

AJAX :: Set MultiHandleSliderExtender Length To A Percent Of Its Container

Mar 18, 2011

I'm using a MultiHandleSliderExtender (very cool) and need to set its Length property to a percent of its DIV container. The extender appears to only allow a decimal value for the number of pixels. Can anyone show me how to set the Length to, say, 95% of the DIV? I suppose using javascript to dynamically set it? I'm a C# guy who struggles with javascript and I cannot make this fly on my own.

<div
style="width:100%;
border:solid
thin red">
<asp:TextBox
ID="TextBox1"
runat="server"
Width="500px"></asp:TextBox><br
/><br
/>
<asp:TextBox
ID="TextBox2"
runat="server"
Text="648"
></asp:TextBox><br
/>
<asp:TextBox
ID="TextBox3"
runat="server"
Text="672"
></asp:TextBox><br
/>
<asp:MultiHandleSliderExtender
ID="TextBox1_MultiHandleSliderExtender"
runat="server"
Enabled="True"
HandleAnimationDuration="0.1"
Maximum="672"
Minimum="0"
TargetControlID="TextBox1"
OnClientDragEnd="SliderDragEnd"
OnClientValueChanged="SliderDragEnd"
Length="1200" >
<MultiHandleSliderTargets>
<asp:MultiHandleSliderTarget
ControlID="TextBox2"
/>
<asp:MultiHandleSliderTarget
ControlID="TextBox3"
/>
</MultiHandleSliderTargets>
</asp:MultiHandleSliderExtender>
</div>

View 2 Replies

SQL Reporting :: Can't Handle Percent Column In Microsoft

Dec 8, 2010

I have a RowGroup on Rows, and a ColumnGroup From A to C

The calculate fields are:

[code].....

Can't Handle Percent Column in Microsoft

View 3 Replies

SQL Server :: Stuff Available For MS SQL Similar Region In C#?

Feb 12, 2011

Similar region in C#, is there stuff available for MS SQL?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved