DataSource Controls :: Select Parts Of Large Tables Optimized?
May 4, 2010
If I have a huge Order-table and I want to display records from it using paging, what is the best way to select the records from the database?
If I first do like this:
[Code]....
..and then select the records I want based on RowNum it seems like I select ALL records in the first query anyway. I guess I want to do something like SELECT TOP @PageSize FROM Orders...
View 5 Replies
Similar Messages:
Jun 1, 2010
I'm facing a problem in our current running application. There is a table in database which has 67 columns,among these 18 columns are nvarchar(max) datatype and contains 30K records. Problem is now that SELECT * FROM myTable it takes around 3 to 4 seconds. Which is degrading our application's performance.
View 12 Replies
Mar 17, 2010
[Code]....
Select statement across three tables
View 15 Replies
Mar 14, 2010
I am trying to count records belonging to a certain person in three different tables in a single select statement. The database looks like this:
Player
-PlayerId
-Name
Game
-GameId
-TournamentId
...
Goal
-GameId (FK->Game.GameId)
-PlayerId (FK->Player.PlayerId)
-Assist (FK->Player.PlayerId)
Card
-CardId
-GameId (FK->Game.GameId)
-PlayerId(FK->Player.PlayerId)
I want to select the number of goals, assist and cards a player has in a specific tournament. I tried with this query but then the goal and card column shows the sum of the number of rows matching the playerid in the Goal table and the Card table...For example if there is two matching rows in the goal table and three matching rows in the card table, I get 5 in both these columns in the resultset.
[Code]....
View 3 Replies
May 19, 2010
I'm using ASP.NET MVC to create a small web apllication.
Here is my database And here is my class
[Code]....
View 2 Replies
Apr 6, 2010
I have two tables:
GalleryAlbums and GalleryPhotos.
I would like to Select all entries in the GalleryAlbums table, but Order them (DESC) by date values in a column (upload_date) on the GalleryPhotos table. Both tables have a column "album_id"
A little confused how I might write this statement.
View 15 Replies
Jul 28, 2010
I am working with VS 2010, Entity framework, SQl-Server 2005, ASP.Net web forms. Currently, I am working on the Data access layer library which soon will be a web service, using Entity Framework collaboration with different design patterns like repository pattern and some best practices that posts in different blogs. I am also test each repository using the Unit testing project. Thumbs up! Working fine.
The thing I am worried about is, how much is good for retrieving data from a table that can contain 80-100k records ?
View 1 Replies
Dec 22, 2010
The drop down list is used to determine what search criteria will be used to find an invoice. I tried to set the Select method in the switch statement. I don't understand how to set the Select Method and the select parameters programmatically though . I tried a few different ways but can't make the compiler happy. My ODS is in scope in the code behind. I'm not able to access it's properties though. The BAL resides in a separate project that is a ClassLibrary. I also have a using statement for the ClassLibrary project in the code behind.
give me an example of how to do this?
Mark up:
[Code]....
[Code]....
[Code]....
[Code]....
View 1 Replies
May 9, 2010
protected void Button19_Click(object sender, EventArgs e)
{
SqlDataSource conn = new SqlDataSource();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["Database2ConnectionString1"].ToString();
conn.SelectCommandType = SqlDataSourceCommandType.Text;
conn.SelectCommand = "SELECT FROM table1 (a, b)VALUES(@a,@b)";
conn.SelectParameters.Add("a",TextBox1.Text);
conn.SelectParameters.Add("b", TextBox2.Text);
int rowsAffected = 0;
try
{
rowsAffected = conn.Selectt();
}
catch (Exception)
{
Label1.Text = "Error";
}
finally {
conn = null;
}
if (rowsAffected != 0)
{
Label1.Text = "Data saved";
}
}
well it returns error no overloading method for select (P.S. same code work fine for insert)
View 5 Replies
Apr 14, 2010
I will declarate a attribute, but it gives me an error
This query works fine and returns 1 record from type int:
SELECT TOP 1 DataObjectVersionID
FROM tblDataObjectVersionPropertyValueText
WHERE PropValue like CAST('00010281' AS ntext)
ORDER BY DataObjectVersionID DESC
And when I will declarate a attribute/parameter it gives me an error:
DECLARE @dataObjectVersionId INT
SET @dataObjectVersionId = SELECT TOP 1 DataObjectVersionID
FROM tblDataObjectVersionPropertyValueText
WHERE PropValue like CAST('00010281' AS ntext)
ORDER BY DataObjectVersionID DESC
Error message:
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'SELECT'.
View 4 Replies
Mar 10, 2010
I want to insert a large amount( approx 7000 records) of data into a table, My scenarios is that i need to check whether the record already exists then it will not insert it. Currently i am using a stored procedure for this which gets called for each record.
IF EXISTS(SELECT 'True' FROM MYTABLE WHERE ID = @ID)
BEGIN
--This means it exists, return it to ASP and tell us
SELECT 'This record already exists!'
END
ELSE
BEGIN
--This means the record isn't in there already, let's go ahead and add it
SELECT 'Record Added'
IF EXISTS(SELECT 'True' FROM [Aadil].[dbo].[SharePointSitesData] WHERE ID <> @ID)
View 11 Replies
Jan 4, 2010
I used SQLMetal to generate a DBML file, which worked fine. The problem is that since this DBML file is so big (185,000 lines at 840Kb) it takes literally hours to load in VS2008. What is the recommended way to resolve this? I tried using a third party tool call SqlMetalInclude to break the DBML up into multiple data contexts, but that tool generates only designer.cs files, not dbml files.
View 2 Replies
Aug 6, 2010
I want to upload some large files from a web page to MS SQL Sever database, I am very sure that it is sounding weird.
File sizes are around 100MB.
I am having following settings,
SessionTimeOut period = 60 Mins,
Server Operation timeout = 60 Mins,
SQL Connection Timeout = 4 mins (Not sure if this is helping)
This is page is going to be used by our client only once a week & as they are having web farm environment we are avpiding to store these files on file systems.
Currenty we are able to upload files with sizes upto 8 MB succesfully. But when we are uploading a file of 100MB it fails, its for sure that operation takes lots of time.
View 4 Replies
Feb 15, 2010
I have contact mails large than 700.000 Mails and i want to insert them in sqlserver using c# in a few minutes not hours i know that pre impossible but , i know there`s way to do it
View 4 Replies
Mar 25, 2010
i am developing an application using ASP.NET with C#.Net and SQL SERVER 2005. here i am importing data from excel sheet to database.in my excel sheet some fields have large data.and for those fields i had taken NTEXT as data type in my database.when i am trying to import the data,the fields which have large text are not inserted completly.i.e some data is missing. the field in database accepts the data upto some characters only.what would be the reason for this? and which data type can i use for inserting large data?
View 8 Replies
Feb 13, 2010
I have the following problem: I need to store in MS SQL Server 2005 a vary large text in to one field of type nvarchar(MAX), In spite of the configuration is apparently correct I keep receiving the following message in the exception: "string or binary data would be truncated".
View 1 Replies
Jul 12, 2010
I have the following tables and fields in SQL:
[Code]....
I'd like to create an XML file(based on the above tables mentioned) which I'd like to bind to a treeview control, but I'm not sure how to do that.
View 2 Replies
Apr 28, 2010
How to get data from two tables through linq .1 ) productsDetails 2) productsImages to bind further listview.
View 1 Replies
May 13, 2010
From using the command: EXEC sp_spaceused on a SQL 2008 database,
the DB has a size of 642.56 MB, unallocated space 148.77 MB.
I can also see the size of the individual tables from the same command:
Reserved: 103656 KB
Data: 98264 KB
Index_size: 2656 KB
Unused: 2736 KB
What I don't quite get is why the total database size is 642.56 MB when the size of the individual tables is so much smaller. We pay for the total amount, in chunks of 500 MB. I was trying to see which tables where causing the DB to be so big, but to me, it looks like it is not the size of the tables but something else.
What should I look at to figure out why we are taking up so much space? Am I not understanding how this works?
View 6 Replies
Jun 15, 2010
I want to know that how many tables we can have in database and what is the maximum no. of columns.I also want to know the maximum size for each datatype.
View 3 Replies
Apr 27, 2010
I need to join some tables to get the matching records. I often have to ask around to see how certain tables could be joined. Is there any way to query the information schema or some thing else to see what columns/values match in certain tables in order to figure out how tables should be joined.
View 4 Replies
Jun 3, 2010
how i insert,update and delete data in multiple table .such tables in which primary and foreign key constraint are
View 1 Replies
May 13, 2010
I'm creating entity on a project to use them as data on my website. I got my base simple entity Users and my DataContext. The thing is i would like the database to create the table as i create Entities.
I mean, actually my database doesn't have a Users table and do not generate it as i build and launch the project. I used to be a Java dev and in Java the table can be created with JPA so i guess Microsoft made it possible with ASP.net but how to do? I've looked on the web but didn't find it.
View 2 Replies
Jun 29, 2010
Apologies if this is in the incorrect forum.. just a question about how to best structure some tables for a particular presentation of data. In the following table (2nd column) you'll see that each motorcycle product applies to a range of years. What is the best way to store this range of years in a relational db? At the moment I have a datefrom and a dateto field for the two ranges, but that may complicate things when I want to filter the table by a particular year. E.G. datefrom is 2006 & dateto is 2010 and I would like to filter by products for a 2008 model.
View 4 Replies
Apr 13, 2010
I have a problem where I would like to get a comma-separated list of items from a couple of tables as part of a set of results. All the searching I've done so far has produced results for dealing with one or two tables. I have four, and can't get my head around how to adapt the sql to deal with it.
I have the following layout:
*Table_Castings*
+---- CastingID {PK}
| MouldID
| SerialNo
| CastRef
| MeltCode
| Signature
|
|
| *Table_CastCertificates* *Table_Certificates*
| CertificateID {PK} ----------- CertificateID {PK}
+---- CastingID {PK} Description
FileID -----------------+
|
|
*Table_CertificateFiles* |
FileID {PK} -------------+
FullLocation
The results I would like include the following columns:
CastingID, MouldID, SerialNo, CastRef, MeltCode, [Certificates],
Where Certificates is a comma separated list of Description + " " + FullLocation records. (What I'll actually do is add http:// and other html codes to make FullLocation a hyperlink, but I can do that.)
Some SQL I've already got is this:
DECLARE @str VARCHAR(500)
SELECT @str = COALESCE(@str + ', ','') + '<a href="http://' + Table_CertificateFiles.FullLocation + '">' + Table_Certificates.Description + '</a>'
FROM Table_CastCertificates INNER JOIN
Table_Certificates ON Table_CastCertificates.CertificateID = Table_Certificates.CertificateID INNER JOIN
Table_CertificateFiles ON Table_CastCertificates.FileID = Table_CertificateFiles.FileID
WHERE (CastingID = 45)
SELECT output = @str
This actually gives all records in the for the specific casting, but I keep getting an error at the "=" in @str = COALESCE when I try joining it to another query to get each casting.
View 3 Replies