Returning Number Of Tables In SQL Server2000 Using ADO In VB6
Jan 11, 2004
I'm using a VB6 application to access data from an SQL Server 2000 database. There are a few things I would like to do:
1. Get the number of tables in the database
2. Automatically begin reading data from each table in the database. Is it possible to write some code that will cause the application to start on first table retrieve all the data, then move to next table (similar to moving to next row)?
Thanks,
Joey
View 6 Replies
ADVERTISEMENT
Oct 24, 2006
how can i get a row number in a query in ms/sql
View 7 Replies
View Related
Aug 8, 2007
Hi all,Ive been trying to figure this out and has proven to be quite difficult for me. Lets say i do a select on all client numbers from a clients table i would want the first available number returned.Given the client table below my query would return 4 because its the lowest number availeble. Thanks. client tableclnum12367
View 4 Replies
View Related
Jul 8, 2004
I am using ORDER BY NEWID() to return random record from sql database. how do i go about returning only 5 random records instead of all records.
Thanks.
View 2 Replies
View Related
Jan 24, 2008
I am trying to return the number of records found by the query but keep seeing -1 in label1. This query should return many records.
sub findcustomers(sender as object,e as eventargs) dim connection1 as sqlconnection=new sqlconnection(...) dim q1 as string="select * from tblcustomers where store='65'" dim command1 as sqlcommand=new sqlcommand(q1,connection1) dim a as integer command1.connection.open() a=command1.executenonquery() label1.text=a.tostring() command1.connection.close() end sub
What am I doing wrong?
View 8 Replies
View Related
Jan 24, 2005
Hi ,,
How to write the Sql Query to return the next generated Identity from the Sql server database.
View 1 Replies
View Related
Nov 5, 2007
Hi
Please help! I'm really stuck. I have a table (AssessorAllocations) that stores the data of students who have submitted assessments for marking by an Assessor. Each time an assessment is submitted by a student my program must determine which Assessor has the smallest workload and then assign the current assessment to that Assessor. My problem is how do I determine which Assessor has the smallest number of assessments assigned to him/her.
The table columns are:
AssessorRegistrationNo
LearnerRegistrationNo
QualficationName
SubjectName
AssessmentName
DateAssigned
Marked
DateMarked
Price
So I'm looking for something like this:
Select AssessorRegistrationNo from AssessorAllocations where {Select the Assessor who has the smallest number of AssessmentNames assigned to him/her where Marked='0' and DateAssigned<>''}
Thanks
Neil
View 4 Replies
View Related
Jul 7, 2004
Hi
I've created a sproc in SQL2000 that returns a dataset from a temp table & the number of records it's returning as an output parameter, although I can't seem to retrieve the value it's returning in asp.net although I get the dataset ok.
This is my sproc
create procedure return_data_and_value
@return int output
as
set nocount on
...
...
select * from #Table
select @return = count(*) from #Table
drop table #Table
go
This is asp.net code
Dim nRecords as Int32
Dim cmd As SqlCommand = New SqlCommand("return_data_and_value", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim prm As SqlParameter = New SqlParameter("@return", SqlDbType.Int)
prm.Direction = ParameterDirection.Output
cmd.Parameters.Add(prm)
conn.Open()
dr = cmd.ExecuteReader
nRecords = convert.int32(cmd.parameters(@return).value)
conn.close
Thanks
Lbob
View 1 Replies
View Related
Nov 26, 2006
Hello people,I might sound a little bit crazy, but is there any possibility that youcan incorporate 4^15 (1,073,741,824) tables into a SQL Database?I mean, is it possible at all? There might be a question of whereanyone would want so many tables, but i'm a bioinformatics guy and I'mtrying to deal with genomic sequences and was coming up with a newalgorithm, where the only limit is the number of tables I can put intoa Database.So, can you please advise if its possible to put in so many tables intoa SQL database? Or is the Bekerley DB better?
View 3 Replies
View Related
Aug 29, 2005
I have two tables and I want to return data from both. Currently my select statement is returning just 1 child record for each parent record and I want to return all child records that match the parent record.
Here's a sample of my tables/data/etc.
t1
------------
speciesid | species
1 | Mammals
2 | Rodents
3 | Reptiles
t2
---------
animalid | animal
3 | Skink
3 | Iguana
3 | Rattlesnake
2 | Meerkat
1 | Hippo
1 | Elk
What I want to do is pull up a list of all the species and under each list all the animals currently listed under that species.
So the result I want should look like:
Mammals (Hippo, Elk)
Reptiles (Skink, Iguana, Rattlesnake)
Rodents (Meerkat)
so currently I have:
SELECT A.animalid, S.speciesid, A.animal, S.species from t2 as A, t1 as S where S.speciesid=A.animalid order by species
this works great, it's just that it only returns one animal instead of all of the animals. Any help would be appreciated.
View 4 Replies
View Related
Sep 28, 2007
We have an archive table which keeps each instance of a sales order that was archived under a "Verion No" field. Each time the sales order is archived it is entered into the archive tables (Sales Header Archive, Sales Line Archive). What I am trying to do is write a query to return all sales orders but only the most recent archived version.
For example this table layout is similar to what I am working with. Version No, Order No and Customer No. are the keys between the Header and Line tables, Customer Name column in the output is from only the Sales Header Archive table
SALES LINE ARCHIVE TABLE
Version No - Order No. - Customer No -----> (other columns)
1 s-5 1000
2 s-5 1000
1 s-6 2000
1 s-7 3000
2 s-7 3000
3 s-7 3000
1 s-8 4000
1 s-9 2000
2 s-9 2000
Here is what I need to output to show:
RESULTS OF JOINED TABLES
Version No - Order No - Customer No - Customer Name ---> (other columns)
2 s-5 1000 Something, Inc.
1 s-6 2000 Acme
3 s-7 3000 Company, LLC
1 s-8 4000 Blah & Associates
2 s-9 2000 Acme
It should return the last Version No of each Sales order.
Does that make sense? It is something probably easy... But, I've spent two days using multiples and multiples of different ways, that just aren't working: I'm about to dropkick my server cabinet...
View 4 Replies
View Related
Nov 23, 2007
Dear All...
is there any limitation that sql server must have these many tablesonly in one database?
and is there any same case with dataset? i faced these in one interview....
i dont know what is dataset and what is the maximum no of tables in a dataset..
please answere me.
thank you very much
Vinod
Even you learn 1%, Learn it with 100% confidence.
View 2 Replies
View Related
Nov 26, 2006
Hello people,
I might sound a little bit crazy, but is there any possibility that you can incorporate 1,073,741,824 tables into a SQL Database?
I mean, is it possible at all? There might be a question of where anyone would want so many tables, but i'm a bioinformatics guy and I'm trying to deal with genomic sequences and was coming up with a new algorithm, where the only limit is the number of tables I can put into a Database.
So, can you please advise if its possible to put in so many tables into a SQL database? Or is the Bekerley DB better?
View 1 Replies
View Related
Feb 11, 2008
I need a query to find max serial number by comparing two different tables. Here is my requirementI am having two tables named Table1 and Table2. Each tables having more than 30,000,000 records.I want a simple query to find Max srno from two tables.For exampleIf Table1 max is 245 where partno=2 and ano=2and Table2 max is 343 where partno=2 and ano=2Then 343 is max serial noIf Table1 max is 435 where partno=2 and ano=2and Table2 max is 34 where partno=2 and ano=2Then 435 is max serial noI used this query but its taking more time select max(v.MaxSrNo) from ((select max(MaxSrNo) as MaxSrNo from Table1 where partno=@partno and ano=@ano)union all (select max(MaxSrNo) from Table2 where partno=@partno and ano=@ano)) as v Pls give me a simple query to find max srno.
View 3 Replies
View Related
Jan 25, 2008
Hi gurus, I'm creating a web application where I will have a large number of tables (between 10k and 20k), this is done for the sake of scalability as tables will be moved to different database servers as the application grows and also for performance (smaller indexes). I'm worried though how having a large number of tables could affect the performance of SQL Server as the application will start on one single database server. I tried to find some resources on that on the internet but couldn't find any.
I would really appreciate if you can give me some advice and if you have any good links that would be great...
View 10 Replies
View Related
Feb 19, 2012
My db contains two table Employee_detail and Student_Detail.Employee_detail has Emp_id and Student_Detail has stud_id.Now my problem is that i want to get one maximum no from these two table.
View 11 Replies
View Related
Apr 6, 2006
Hello , I have 870 tables in a database and I need to sort tables by row numbers to get the ones having biggest number of rows , is there a query?
F16 LĂ?GHTĂ?NĂ?NNNG
View 3 Replies
View Related
Aug 24, 2007
I am new with SQL and I am Oracle DBA, trying to learn SQL. Any way, in SQL, is there a view or tables that you can run to pull out a list of the databases inside an instance? I don't want to use the GUI though.
thx
View 3 Replies
View Related
Jan 25, 2008
Hi gurus, I'm creating a web application where I will have a large number of tables (between 10k and 20k), this is done for the sake of scalability as tables will be moved to different database servers as the application grows and also for performance (smaller indexes). I'm worried though how having a large number of tables could affect the performance of SQL Server as the application will start on one single database server. I tried to find some resources on that on the internet but couldn't find any.
I would really appreciate if you can give me some advice and if you have any good links that would be great...
Waleed Eissa
http://www.waleedeissa.com
View 9 Replies
View Related
May 24, 2006
I have 2 tables
tblOpenSiteDates
Site: int
OpenDate: smalldate
Comment: VarChar
tblCloseSiteDates
Site: int
CloseDate: smalldate
Comments: VarChar
newLocationID: int
I am trying to get a view which would display a site with the open and close dates. Null is ok for a close date for those opens that are still open.. not every office has an open date and close date.. it is possible to have just a close date and not an open date (ie unsure of open date but I know its closing)
so the output would be
viewOpenCloseSites
Site: int
opendate: smalldate
closedate: smalldate
PLEASE HELP i just can not figure it out
thanks...
View 1 Replies
View Related
Jul 20, 2005
I have a requirment to take data from a large set of tables where thetotal number of these tables may change on a regular baisis andoutput into another table. All the tables willl have the samecolumns. Frequency is being debated but it maybe as much as once perhour.Example1) I need to choose all the following tablesselect * from dbo.sysobjects where name like '_CPY%.2) then I need the followingfor each of the tables found above, I need the outfrom from each ofthose tables to be inputted into another table. basically, I wouldwant the following output from each of the tables found in step 1select machineid,name from _cpy_offermanager_6783) In the end I would have something like dbo.ALLCPY with recordscombined from all other _CPY tablesRon Sorrell
View 2 Replies
View Related
May 23, 2002
Table structure: col1 IDENTITY (seed=1 increment=1) + few other columns (col2...col7) + one text column (col 8)
I have around 50,000,000 rows per day inserted in the table T1. At the end of the day 40,000,000 rows are deleted. I have to keep the records for 12 months and then archive it. Database is 24/7 web serving and there is no down time allowed. IDENTITY column will go out of range (overflow) after less than two years, unless the identity seed is reset to the start value (seed=1, increment=1).
At the end of 12th month data is archived in another table and only last month is kept in the table T1. So table T1 enters new year with data from last month of the previous year. There are few other tables that refer to this table by using there own field with values from T1.IDENTITY column (referential integrity is not enforced). Identity column in T1 is needed as a unique id for some search actions. Performance is an issue therefore bigint data type is used for this identity column rather than decimal.
Another problem I have is how to do table update on one column (1 mil rows to be updated out of 2 mil of rows) with the minimum impact on the users who are querying this table heavily. Not need to mention that it is web app 24/7 no down time.
Thank you in advance.
Goran
View 1 Replies
View Related
Feb 2, 2012
I am trying to export the data from a number of MSSQL 2000 tables to UTF8 csv files.
Using the bcp that came with MSSQL 2000 didn't work (UTF8 related), so I am now accessing the 2000 database from within MSSQL 2008 R2 Management Studio and use its Import and Export wizard that does make UTF8 exports possible.
But it fails. This is the error I got for one table.
Code:
- Validating (Error)
Messages
Error 0xc00470d4: Data Flow Task 1: The code page on input column "cmsGUID" (74) is 1252 and is required to be 65001. (SQL Server Import and Export Wizard)
Error 0xc00470d4: Data Flow Task 1: The code page on input column "PublicationStatus" (79) is 1252 and is required to be 65001. (SQL Server Import and Export Wizard) ....
What do I have to do?
View 2 Replies
View Related
Aug 31, 2014
SQL query to understand the names of all the available tables , number of records in these tables and size of these tables?
View 4 Replies
View Related
Dec 9, 2014
What is the maximum no.of global temporary tables can create in sql server
View 4 Replies
View Related
Feb 11, 2014
Other than right-clicking on each individual table in SSMS and generating a CREATE script, is there a simple way to generate CREATE TABLE scripts for tables within a given database?
Background: I have a bunch of tables in one database, and I would like to add tables to a second database that have the same names and basic structures of some of the tables from the first database.
I do not need to transfer any data from the tables, this is a seperate project that will use a similar data structure. I just want to generate the CREATE TABLE scripts for 30ish tables within the first database, and then I'll tweak the scripts as appropriate and run them against the new database.
[URL] ....
View 7 Replies
View Related
Aug 27, 2007
When I try to install MS SQl server2000 on windows XP machine,it says the server component is not supported by OS.What should I do to get it run on my machine?
View 3 Replies
View Related
Feb 3, 2008
Hi,
I'm Arash Baseri a Sql Server2000 developer and mail you from Dubai (U.A.E). I have a problem in Sql Server locking table. My problem is not reasonable so the more I researched the more I understand it is not my problem .it is a bug in Sql Server2000.
Now I explain the situation:
I have two tables (Table A and Table B).Table A has a clustered index on col1 and col2, Table B has a clustered index on col1 and col2. I join these tables and update col3 in table A, like this
begin tran
insert [Table A]
select * from Arshiv_Master where Col1 between 26001 AND 26001
Update AI31 set Col3=Case
when 1=1 then 1
Else 0 End
From [Table A]AI5, [Table B]AI31
where AI5.Col1=AI31.Col1 And AI31.Col1 Between 26001 And 26001
/* intentionally I didn't rollback or commit transaction to hold locks on table*/
In another connection I execute this query and I face "Lock request timeout period exceeded" error message.
set lock_timeout 1
set transaction isolation level read uncommitted
Update AI31 set Col3=Case
when 1=1 then 0
Else 0 End
From [Table A] AI5, [Table B] AI31 where AI5.Col1=AI31.Col1 and AI31.Col1 between 45018 And 60000
Now the most interesting part is here .when I use a smaller data range for Col1 no error message is shown. A query like this
set lock_timeout 1
set transaction isolation level read uncommitted
Update AI31 set Col3=Case
when 1=1 then 0
Else 0 End
From [Table A] AI5, [Table B] AI31 where AI5.Col1=AI31.Col1 and AI31.Col1 between 45018 And 50000
As you see the difference between the last two queries is on WHERE clause especially on data rages of Col1.
As you know Sql Server 2000 has row level lock and when I acquire a lock on a record the other records are free. So what's wrong with Sql Server that assumes the others records are locked. I tested this situation in Sql Server 2005 and this problem was not seen so I think it's a bug in Sql Server 2000.Who can help me about this problem?
View 1 Replies
View Related
Feb 2, 2008
Hi,
I'm Arash Baseri a Sql Server2000 developer and mail you from Dubai (U.A.E). I have a problem in Sql Server locking table. My problem is not reasonable so the more I researched the more I understand it is not my problem .it is a bug in Sql Server2000.
Now I explain the situation:
I have two tables (Table A and Table B).Table A has a clustered index on col1 and col2, Table B has a clustered index on col1 and col2. I join these tables and update col3 in table A, like this
begin tran
insert [Table A]
select * from Arshiv_Master where Col1 between 26001 AND 26001
Update AI31 set Col3=Case
when 1=1 then 1
Else 0 End
From [Table A]AI5, [Table B]AI31
where AI5.Col1=AI31.Col1 And AI31.Col1 Between 26001 And 26001
/* intentionally I didn't rollback or commit transaction to hold locks on table*/
In another connection I execute this query and I face "Lock request timeout period exceeded" error message.
set lock_timeout 1
set transaction isolation level read uncommitted
Update AI31 set Col3=Case
when 1=1 then 0
Else 0 End
From [Table A] AI5, [Table B] AI31 where AI5.Col1=AI31.Col1 and AI31.Col1 between 45018 And 60000
Now the most interesting part is here .when I use a smaller data range for Col1 no error message is shown. A query like this
set lock_timeout 1
set transaction isolation level read uncommitted
Update AI31 set Col3=Case
when 1=1 then 0
Else 0 End
From [Table A] AI5, [Table B] AI31 where AI5.Col1=AI31.Col1 and AI31.Col1 between 45018 And 50000
As you see the difference between the last two queries is on WHERE clause especially on data rages of Col1.
As you know Sql Server 2000 has row level lock and when I acquire a lock on a record the other records are free. So what's wrong with Sql Server that assumes the others records are locked. I tested this situation in Sql Server 2005 and this problem was not seen so I think it's a bug in Sql Server 2000.Who can help me about this problem?
View 1 Replies
View Related
Sep 25, 2007
I am opening a simple command against a view which joins 2 tables, so that I can return a column which is defined as a tinyint in one of the tables. The SELECT looks like this:
SELECT TreatmentStatus FROM vwReferralWithAdmissionDischarge WHERE ClientNumber = 138238 AND CaseNumber = 1 AND ProviderNumber = 89
The TreatmentStatus column is a tinyint. When I execute that above SQL SELECT statement in SQL Server Management Studio (I am using SQL Server 2005) I get a value of 2. But when I execute the same SQL SELECT statement as a part of a SqlDataReader and SqlCommand, I get a return data type of integer and a value of 1.
Why?
View 5 Replies
View Related
Oct 11, 2001
HI,
I have a application which has Access as Front end and SQLServer as BackEnd.
I have a table which has student details.
Table Fields are:
Record#,FirstName,LastName,MiddleName,Address,City ,State,Pin,.....
The table has about 1200 records.
Every Thing works fine but in the front end when i try to do a search by
FirstName it is VERY SLOW.But it is okey if i search by the Record#.
I need to search by lastname or Firstname and speed up the process.
Any Help will be appreciated,
Thanks,
Rang.
View 1 Replies
View Related
Apr 5, 2001
What are the experiences of those who have upgraded to
View 2 Replies
View Related
Apr 5, 2001
What are the experiences of those who have upgraded to SQL Server 2000?
I am writing a paper for my company and wish to list features of SQL Server 2000 from a user/developer/business aspect. We are on
SQL Server 6.5 and I need to highlight the advantages and disadvatages of upgrading.
Thanks
Jeff
View 7 Replies
View Related