|
Have you really run that?
This query does not return the desired result. It returns only the record with the max Score.
And up to ten records when multiple records hold the max score.
@Prasadbuddhika:
Furthermore this is a very basic requests, therefore I suggest investing some time in studying!
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
|prasadbuddhika wrote:
from amployee table i want to get 10 employees who get the heigest 10 salaries
And he is not complaining its working for him and it brings desired results for me too
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
I have been told the answer is very simple - but despite asking on many forums nobody has given me the answer.
Could you help me.
What would the code in VB.net, to - within a single msaccess database - (on a batch basis) examine a record in one table, and then dependant on the results of the examination(ie the value of a status field), add a new record to a second table, and then continue looping through this function until the end of the first table.
Sorry if it seems simple - but I think I am - simple that is...
:->
|
|
|
|
|
The approach of retrieving and looping through individual records is very time consuming when you consider that SQL is set based. Consider using an INSERT INTO based on a select instead. Here's an example:
INSERT INTO table2 (value1, value2, value3)
SELECT value1, value2, value3
FROM table1
WHERE status = 'Hello' This will insert all the records that match the criteria in table1 into table2.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I am schema qualifying a stored procedure when calling it such that if I have a database named 'MyDB1' and the stored procedure 'GetContacts' that belongs to 'dbo' schema, I can call it like:
EXEC MyDB1.dbo.GetContacts
However, I need to be able to dynamically call the stored procedure from different databases that that have the same stored procedure such that i can call them like:
EXEC MyDB1.dbo.GetContacts
EXEC MyDB2.dbo.GetContacts
EXEC MyDB3.dbo.GetContacts
Is there a way I can use a variable name in place of the database name such that I can call the stored procedure like:
DECLARE @DBName NVARCHAR(20)
SET @DBName = 'MyDB1'
EXEC @DBName.dbo.GetContacts
and so forth, ...
Or, what options do I have?
|
|
|
|
|
Hi,
you can use sp_executesql N'exec <stored_procedure_name>'
where <stored_procedure_name> is constructed as @DBName.dbo.GetContacts
You can also pass parameters on this way. Take a look at http://msdn2.microsoft.com/en-us/library/ms188001.aspx
Best regards,
DLM@bypsoft.com
|
|
|
|
|
Can anyone tel me what is the difference between Number datatype and integer datatype in Tsql and how much the capacity they are having??
prasannaarumugam
|
|
|
|
|
Do you mean numeric? If so, the numeric datatype can have a precision.
An int is stored in 4 bytes and has the capacity of -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647). The numeric is functionally equivalent to the decimal datatype, and when maximum precision is applied, valid values range from - 10^38 +1 to 10^38 - 1.
All of this information was easily identifiable in SQL Server Books On-line or Google. Please use those as your first port of call next time and don't ask us to do your research for you.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have several excel files(*.xls) that I'm extracting data from using Visual Basic and I'm having problems with my SQL statement. I would like to do a count & group by in the statement to input this data into a control sheet but I continue to get an error message when filling the dataset.
Error: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in microsoft.visualbasic.dll
Code Snippet:
Function groupxls(ByRef xlfile As String, ByRef xlsfile As String)
Dim ex1 As String = "Provider=Microsoft.Jet.OLEDB.4.0; " & "data source=" & xlfile & ";" & "Extended Properties=Excel 8.0;"
Dim conn1 As New OleDbConnection(ex1)
Dim dtset1 = New DataSet
Dim flnme As String
y = xlsfile.LastIndexOfAny(".")
flnme = xlsfile.Remove(y, 4)
Dim col1 As String = "sc_typname" '<-----Column to group by
Dim MyCommand1 As New OleDbDataAdapter("select count(*) from flnme group by col1", conn1)
MyCommand1.Fill(dtset1)
DataGrid1.Refresh()
DataGrid1.DataSource = dtset1.Tables(0)
conn1.Close()
conn1.Dispose()
End Function
If anyone can take the time to look at this for me please know that it will be very much appreciated! Thanks in advance!
Swish
|
|
|
|
|
Swisher24 wrote: Dim col1 As String = "sc_typname" '<-----Column to group by
Dim MyCommand1 As New OleDbDataAdapter("select count(*) from flnme group by col1", conn1)
You are passing the name of the variable to the query string instead of the value of the variable, try the following:
Dim MyCommand1 As New OleDbDataAdapter("select count(*) from flnme group by " + col1, conn1)
|
|
|
|
|
Thanks aztekka!
I tried this sql statement and I'm still getting an Unhandled Exception Error. I'm thinking that VB 2003 doesn't like the statement somehow. I will continue to work on this and any more help that can be provided will be very appreciated.
Swish
|
|
|
|
|
Hi every body
I have a question about using typed DateSet in web application? Is it a good approach to use a typed DataSet in web app(i mean making dataset with wizard in .NET 2.0).Does it based on oop concepts? If not, what is the best way for accessing data in a web app? Another point is that i want to use 3layer programming,I read that this way will make a data layer.Am I right?I don't know the advantages and disadvantages of this approach.I will be apprisiate if you help me.
Regards
Masoumeh
|
|
|
|
|
can any one tell me how to pass the output parameter in the execution statment in sql. and explain the details about that..
prasannaarumugam
|
|
|
|
|
exec SP_storedProcedure 2,2,@outParameter out
Rami Abdalhalim
|
|
|
|
|
Example:
exec SP_storedProcedure 2,2,@outParameter out
|
|
|
|
|
THANKS FOR YOUR ANSWER
prasannaarumugam
|
|
|
|
|
Hi.
Any idea what happens if multiple instances of an application try to insert records into the same table of a database at the same time?
Will all of them succeed? Will only the first one to come be allowed to do it?
Is there any chance to screw up the database?
PS: I am using Access at the moment, but the question is also for SQL Server and MySql.
Thank.
|
|
|
|
|
blackjack2150 wrote: Any idea what happens if multiple instances of an application try to insert records into the same table of a database at the same time?
Will all of them succeed? Will only the first one to come be allowed to do it?
Is there any chance to screw up the database?
In answer to your questions:
Yes.
Maybe
Maybe
Yes
If multiple inserts are performed at the same time the first will lock the table and the others will wait for access.
If the update is quick enough all will succeed. If the update operation takes too long some INSERTs may fail becuase they timed out.
And there is the opportunity to screw up the database. If you update the same bits of data in different ways only the last update will persist as it overwrites the previous updates. This may not be what you want.
|
|
|
|
|
I was affraid so.
Thanks!
|
|
|
|
|
plz I need to know in sql 2005 which data type is case sensitive.
BiG RaLpH
|
|
|
|
|
It depends on the collation that has been set up.
|
|
|
|
|
I have to input data into 2 fields that are primary keys and some of the only difference between the data is the case. one is uppercase the other is lower case. I tried the nchar the nvarchar and the char. it works if I use the binary but how can I display these if they r in binary.
BiG RaLpH
|
|
|
|
|
go to Modify for table and set collation for field case sensitive any for language
Rami Abdalhalim
|
|
|
|
|
Thx rami it worked
BiG RaLpH
|
|
|
|
|
Big Ralph wrote: it works if I use the binary but how can I display these if they r in binary.
Where did I say anything about binary?
|
|
|
|