.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

SQL ERROR : showing maximum records 9 even if more than 10 records exist in table!!

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :

hiii guys,,

i dont know how to deal with this error. i have 4 tables. each with equal and same columns. all tables have more than 10 records. when i fire a query to find out maximum records , it shows only 9. datatype used is varchar. and since this is very crucial as it is used as primary key and its a student id which gets incremented every time a new student adds to the 4 tables(in vb.net). my whole project is stuck cos of this. if i get this i have no other work to complete for my project.it will be over.


front end is vb.net

back end is sql.


i want that everytime when user inserts an entry and press a button,he should get student id + 1 from the existing.but it is only showing me 9records and always there's a ambiguity of 10th record in database..


guys pls help out of this!!!!

View Complete Post

More Related Resource Links

What is the maximum number of records in a table which can be used to build/apply a model


Dear All,

I am building an association model , if my nested table records is more than 1 lac, model is failing.

Even same while applying the model also. Server's RAM size is 16GB.

Please can you suggest the maximum number of records that can be handled?

Thanks in Advance

Showing filtered Records in Crystal Report as per User Requirement


ReportDocument reportDocument = new ReportDocument();
    ParameterField paramField = new ParameterField();
    ParameterFields paramFields = new ParameterFields();
    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            paramField.Name = "@Ext";
            //*Remember to reconstruct the paramDiscreteValue and paramField objects
            paramDiscreteValue.Value = 44854
            CrystalReportViewer1.ParameterFieldInfo = paramFields;

Duplicate records find in table

  Hi ALL, I want to find the dynamically check the primary key values and remove the duplicate records.. please suggest it.   Regards Ram

Selecting different no. of records from the same table

Hello all, This might seem a basic thing but bothering me from last few days. Suppose I have a table containing 5 million records and I am running queries one by one (one query executes completly and then next query is fired)as below on that table. SELECT top 20000 FROM MyTable SELECT top 200000 FROM MyTable SELECT top 2000000 FROM MyTable  Now my questions are; Will SQL Server use same execution plan? As I am running these queries one by one in same order as given above, will second query take less time than it should if run standalone (only second query is fired, no query fired before that) and similarly will third query take less time than it should if run standalone (only third query is fired, no query fired before that), since there is a possibility of same execution plan being used?  Regards.    

I have relation many to many - how can I delete records from intermediate table ?

I have tables: Books id title Authors id name BooksAuthors book_id author_id Entity Framework generated only models for tables Books and Authors in relation many to many. How can I delete from table BooksAuthors all records where book_id =5 ?

Get the count of the recently added records to a table

i need to create 2 temporary tables. The records inserted into the 2nd table is the same as that from table1. Now, i am inserting some other records into table 2.what i need is, to retrieve the count of the recently added records into table2.How to achieve this? 

More than one records return error

Hi Below is my query used in procedure. This query can return no records or more than one records. If this is the case then I wanted to return error message. How to do this? Select Band, SimpleBand into <complexband>, <simpleband> from HHSRS_HazardBand where lowerbound <= <hazardscore> and upperbound > <hazardscore>  

Cannot Insert records in table using NHibernate

I am very much new with NHibernate. I am inserting a new record in the table. However, it seems that it does not insert. What I'm using is Fluent NHibernate.Below is the code which inserts records. public virtual void Save(string CreatedBy) { ISession NHSession = Star.CNPL_BusinessObjects.Common.Session.OpenSession(); ITransaction NHTransaction = NHSession.BeginTransaction(); try { this.Save(CreatedBy, NHSession); NHTransaction.Commit(); NHSession.Flush(); } catch (Exception ex) { NHTransaction.Rollback(); throw ex; } } public virtual void Save(string CreatedBy, ISession Session) { try { if (this.IsPersisted) { this.SaveAuditTrail(Session, false, CreatedBy); Session.SaveOrUpdateCopy(this); } else { Session.Save(this); } } catch (Exception ex) { throw ex; } }

Upload millions of file records to a table

I have six input files having millions of record. I need to upload these data to my table. How can I upload the details in the most efficient way. Any help on this will be greatly appreciated.

Problem with listing records from table (object not found)

Hi everyone, I'm creating a website based on ASP.NET MVC 2 and SQL Server 2008 R2 Express for the database. After creating the table in database, I want to list all records in that table. For that, I use "scaffold'ing in ASP.NET to automatically generate the view file. But I encountered an error when loading that page. The error message was: [CODE] Server Error in '/' Application. Invalid object name 'dbo.Accommodations'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Accommodations'. Source Error: Line 41:         </tr> Line 42: Line 43:     <% foreach (var item in Model) { %> Line 44: Line 45:         <tr> Source File: d:\MyProject\Views\Accommodation\Index.aspx    Line: 43 Stack Trace: [SqlException (0x80131904): Invalid object name 'dbo.Accommodations'.]    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584 &n

how to return records in squence of inner join table?

Hi, I have test database with following script. I am trying to explain my problem with this sample db script. I am creating a temp. table with the ordered column from other table and then using that table to join the other table. If you notice the output of the below select query, the returned rows from first table are in the sequence of insertion not in the sequence of the temp. table. Is there any other way to retrieve rows in the sequence of temp. (joined) table? CREATE TABLE [dbo].[Table_2]( [c1] [int] NULL, [c2] [nvarchar](50) NULL ) ON [PRIMARY] GO INSERT [dbo].[Table_2] ([c1], [c2]) VALUES (1, N'z') INSERT [dbo].[Table_2] ([c1], [c2]) VALUES (2, N'y') INSERT [dbo].[Table_2] ([c1], [c2]) VALUES (3, N'x') INSERT [dbo].[Table_2] ([c1], [c2]) VALUES (4, N'a') INSERT [dbo].[Table_2] ([c1], [c2]) VALUES (5, N'b') INSERT [dbo].[Table_2] ([c1], [c2]) VALUES (6, N'c') CREATE TABLE [dbo].[Table_1]( [c1] [int] NULL, [c2] [nvarchar](50) NULL ) ON [PRIMARY] GO INSERT [dbo].[Table_1] ([c1], [c2]) VALUES (3, N'x') INSERT [dbo].[Table_1] ([c1], [c2]) VALUES (2, N'y') INSERT [dbo].[Table_1] ([c1], [c2]) VALUES (1, N'z') INSERT [dbo].[Table_1] ([c1], [c2]) VALUES (6, N'c') INSERT [dbo].[Table_1] ([c1], [c2]) VALUES (5, N'b') INSERT [dbo].[Table_1] ([c1], [c2]) VALUES (4, N'a&

Problem Facing While Inserting records into table which os dynamicaly created

Hi,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)declare @cmd varchar(5000)Set @cmd = 'Create Table  ' + @STUDENT_Table + '(   [student_id] [varchar](10)NOT NULL,    [school_id] [varchar](50)NULL,    [class1] [varchar](50)NULL,    [division1] [varchar](50)NULL,    [educalis_id] [varchar](16)NULL,    [roll_no] [varchar](10)NULL,    [first_name] [varchar](50)NULL,    [middle_name] [varchar](50)NULL,    [last_name] [varchar](50)NULL,    [gender] [varchar](6)NULL,    [father_name] [varchar](50)NULL,    [mother_name] [varchar](50)NULL,    [father_office_address] [varchar](200)NULL,    [mother_office_address] [varchar](200)NULL,    [home_address] [varchar](200)NULL,    [father_mobile_no] [varchar](10)NULL,    [mother_mobile_no] [varchar](10)NU

How to copy a table record and all related table records linked via relationships...

Hi!I'm using SQL Server 2005 in a project, and i need to duplicate a record from a table and all it's relationships. Can this be done? If so, can anyone tel me how please.

How to read records in a table one by one?

hi friends, i have briding table that holds userid and roleids, i was given the user_id to get all the role_id s that this user has. i could do a select statement with a where clause. select role_id from UserRoles where user_id = 28 this returns a list of the role_id, But how do read each row returned by the above statement so that i could insert each row to another (virtual) table? thanks          

Most Recent records from one of the table among the tables in multiple joins.


Hi All

I have a single select query with multiple table joins in it.

I want to retrieve the Most Recent records from one of the table among the tables in multiple joins.


(select t1.col1, t2.col2 , t3.col3, t4.col4, t4.Add_Date,t5.col5,

from dbo.table1 t1

left outer join dbo.table2 t2 on t1.col1=t2.col2

left outer join

(select col3 from dbo.table3 where condition1="expr") as t3

on t1.col1=t3.col3

left outer join dbo.table4 t4 on t1.col1=t4.col4 order by t4.Add_Date

left outer join dbo.table5 t5 on t1.col1=t5.col5 )

Problem is that, I am not able to use the "Order by" for a particular table.



Delete Duplicate Records from MySQL table


I have Revision column in Quote table with time stamp (MySql table) now i am viewing the entire date and time my end user want to view only Date he doesnot want to see time how can i pull only date.i am displaying revision column in two ways one in grid view and another one in field value

Query in my Grid view
Dim query As String = "SELECT QuoteNumber,Revision,Vendor,PartNumber,status,Customer,Requestor from quotes"
On select check box in grid view, filed values will be loaded with data.

field value
txtRev.Text = dt.Rows(indx)("Revision").ToString()




Loop through table records using variable


I know it’s possible to loop through table records using a variable and a For Each Loop Task. But is there a way to use the values in the variable and use them in a File System Task? When I tried, the File System Task complains that the variable is not a string. Any thoughts?


Objective – I need to loop though column values in a table which has the paths to the files that I’ll need to move using File System Task.   The table only has one column which stores the paths to the files to be moved.


Thanks in advance.

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