|
hi,
first read all the values in a vector and the use array.sort(vector) .
then you can take the values.
hope this help.
|
|
|
|
|
Are you sure you can do that? I've never seen anything like that in SQL.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Use the TOP keyword like so:
SELECT TOP 2 salary FROM tablename
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
smyers wrote: SELECT TOP 2 salary FROM tablename
I think you need to sort it in descending order to get the result what author expected
|
|
|
|
|
Don't lie, you just made that up.
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
smyers wrote: Don't lie, you just made that up.
|
|
|
|
|
SELECT TOP 2 Salary FROM TableName ORDER BY Salary DESC
|
|
|
|
|
use
SELECT TOP 2* Salary FROM TableName ORDER BY Salary DESC
Sathiya
|
|
|
|
|
Hi,
There is sqlserver 2005 installed in my machine. but i am not able to find the northwind database in the management studio . Can anybody help me to find this database. should i install any addiotional files to get northwind database.
Thanks in advance
Sebastian
|
|
|
|
|
You need to download them from microsoft's site.
Northwind is for 2000 and whilst it works on 2005 AdventureWorks is the sample designed from 2005 and is the recommended sample.
Northwind[^]
AdventureWorks[^]
|
|
|
|
|
Thank you very much .
sebastian
|
|
|
|
|
no problem
|
|
|
|
|
Hi All,
I have two datatables, one datatable named "dtRecords1" gets filled from excel sheet, having column name "Name","Category", and on run time i have added a Identity column to "dtRecords1".
Second Column gets filled from sql server database having three columsn "ID as Identity","Name","Category".
Now i want to merge these two tables, i want this result from merge.
If there are some changes in first datatable, depending upon all columns (comparing all column values) and ID Is same,it should be overwrited, and if there are some new rows these also should be added to the resulted database.
Example:
Datatable1 from excel
ID,Name,Categoey
1,adnan,SE
2,ali,SSE
3,Imran,JSE
Datatable2 From SQL Server DB
ID,Name,Category
1,adnan,SSE
2,ali,SSE
Resulted Datatable
ID,Name,Category
1,adnan,SE -Changed ROw
2,ali,SSE -Unchanged Row
3,Imran,JSE - Newly added Row
Many THanks & Best Regards,
adnan
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
I don't think there is a merge method in the DataTable class, there is in DataSet though if all else fails.
I'm sure you could use importrow though like so:
for (int x = 0; x < datatable2.Rows.Count; x++)
{
datatable1.ImportRow(datatable2.Rows[x])
}
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
I am 100% sure there is method merge in datatable, when i create instance of datatable, press dot, you will also see, merge method.
Will you please help to fullfill the requirment that i have asked in question or explain what you have in this loop.
Many Thanks,
adnna
Many Thanks,
Adnan Rafiq
muhammadadnanrafiq@gmail.com
|
|
|
|
|
Sorry, I didn't check.
Google datatable.merge
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
I have search many newsgroup on the world. No one know is there are any driver availible. My ASP.Net 2 project now cannot run properly on x64 system on exporting data to Excel format.
Is it no way to use OLEDB in the future? No solution to fix my problem?
|
|
|
|
|
The Microsoft Jet database engine has not been ported to x64 and will not be in future. The 'Excel' provider was actually part of Jet.
As I recall you had to go through the ODBC driver in any case. The MSDA provider is no longer supported on x64 either, IIRC. You should really use OdbcConnection etc rather than OleDbConnection if you're using an ODBC driver.
Your only option, I think, is to use a 32-bit worker process. See here[^] for information.
|
|
|
|
|
i want to retrieve 10th or 20th like Nth maximum record in a table
Sathiya
|
|
|
|
|
I want people to do a quick search before posting ... but I guess we don't always get what we want :P
nth row[^]
|
|
|
|
|
DECLARE @nth as bigint
SET @nth = 10
SELECT * FROM TblA AS a WHERE @nth = (SELECT COUNT(ColA) FROM
TblB AS b WHERE b.ColA >= a.ColA)
This will return 10th Max.
change value of the variable @nth to get the required Max.
Regards
KP
|
|
|
|
|
i'm using MS SQL SERVER 2005 and this is my connection string to sqldb.
<add name="MSSQL"
="" providername="System.Data.SqlClient" connectionstring="server=xx.xxx.xx.xx;database=HR;uid=xxxxx;pwd=xxxxxx">
and now i need to connect to DB2 and i don't know how..
what should i use for providerName?
and do i need more information(e,g port) ??
please help~~~
|
|
|
|
|
You need a DB2 provider. IBM make one, which you can download from their website somewhere. We needed to connect to DB2 on an AS/400, for which the security setup in IBM's provider didn't work, so we're using a third-party one from DataDirect named DataDirect Connect for ADO.NET[^].
|
|
|
|
|
I have the following query and I am calling UDF defined function. But when i runuit it gives me following error message
Msg 229, Level 14, State 5, Line 1
EXECUTE permission denied on object 'TimeDifference', database 'twcsan', owner 'dbo'.
SELECT
tck.tcktreceived,
tck.ticketid,
tckmsg.tcktmessage,
dbo.TimeDifference(tck.tcktreceived, GETDATE())
FROM tbtickets AS tck
INNER JOIN tbticketsmessages AS tckmsg ON tck.ticketid = tckmsg.ticketid
seema
|
|
|
|
|
What User name you have used to login to DataBase...
If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
|
|
|
|