|
Use the TOP predicate. Select the TOP 1 record which is not in the set of TOP 4 records.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
try this,
<br />
declare @n int<br />
SET @n=5<br />
SELECT DISTINCT (a.salary) FROM Table1 a <br />
WHERE @n=(SELECT COUNT(DISTINCT(b.salary)) FROM Table1 b WHERE a.salary<=b.slaray) <br />
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
I want to create an query in which i want to show the data out put as show below is it possible?
Database: Northwind
Table : Products
ProductId CategoryID
1 1
1 2
1 3
Output should be coma delimited as shown below.
ProductID CategoryID
1 1,2,3
Thanks in advanced
Sasmi
|
|
|
|
|
Did you search Google[^]?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
try JOIN function
Becoming Programmer...
|
|
|
|
|
This[^] can help, if you are using SQL Server 2005.
And next time please give your message a more descriptive subject.
|
|
|
|
|
Hi,
I am using MSSQL 2000 and MS.NET 2.0
I have some doubt.My requirment is I need to select some data (ie status=3) from webserver's database and insert it into my local machine's Database.Table structure in both server are same.And at the same time i need to update the status of the selected rows to 4.
Now my idea is, a class contain two functions.One is for DownloadWeb and other is InsertLocal .
The DownloadWeb return a dataset(selected data) and InsertLocal insert the the table in dataset to local database.
My doubt is where i place "update status=4" query..
I write one sp in my webserver like
<br />
BEGIN TRANSACTION<br />
BEGIN<br />
SELECT data<br />
END<br />
BEGIN<br />
UPDATE status=4<br />
END<br />
IF @@ERROR <> 0<br />
BEGIN<br />
-- Rollback the transaction<br />
ROLLBACK <br />
RETURN -1<br />
END<br />
COMMIT<br />
or any other idea????
Be very grateful for any advice.
Regards
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same CrazySanker
|
|
|
|
|
what if the Sql Transaction (Insert) to Local Server fails? You can't Rollback the Update transaction happened on the other SQLServer.
what about this alternative(using ADO.NET SQLTransaction object)?
1. DownLoadWeb (select data from Server1)
2. InsertLocal (Insert data to Server2) - SQLTransaction object
3. UpdateStatus (update Status in Server1)
Use a SQLTransaction object for the Insert operation. make sure (2) and (3) are successfull and then commit the transaction otherwise Rollback.
Regards - J O H N -
|
|
|
|
|
Thank you so much.. let me check the SQLTransaction object ..
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
Hi,
I'm currently working on a project to read in an excel file and display it using a DataGrid.
However every time I try to open the connection I get the error - Could not find installable ISAM. I have Office 2007 installed and have also installed the Access Data Acces components.
This is the current code that opens the connection
OleDbConnection cnCSV = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\test.xlsx;Extended Properties=Excel 12.0;HDR=NO");
cnCSV.Open();
Does anyone know a work around for the ISAM? Do I need to re-install MDAC?
Paul
|
|
|
|
|
Please don't cross post.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I didn't. This particular issue falls under two topics, it may well be an ADO.NET issue, or a C Sharp issue, so hence my post in both forums.
Paul
|
|
|
|
|
oceanexplorer wrote: I didn't. This particular issue falls under two topics, it may well be an ADO.NET issue, or a C Sharp issue, so hence my post in both forums.
Yes you did. You posted the same question in 2 forums. This is called cross-posting and is frowned upon because it makes it difficult for people to collaborate on a solution.
In future, try and be more considerate. Choose the most appropriate forum for your question and post there only.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi, guys. I have a string that represents a path to a file. However, the file is the wrong type and needs to be converted to a different file type. I need the file to be a .CSV file instead of a .XLS file type.
If I had a string representing the entire path to the file, including the .XLS, how would I truncate the .XLS and replace it with .CSV?
-- modified at 14:19 Friday 9th November, 2007
|
|
|
|
|
select reverse(substring(reverse('C://hello/world.txt'), 5, 100))
|
|
|
|
|
So - not stumped by the guaranteed stumper then.;)
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm creating a dataset with the following code:
DataSet m_xmlData = new Dataset("Modules");
m_xmlData.Clear();
m_xmlData.ReadXml("thisfile.xml");
I've got this much code written to retrieve the data from the dataset:
int tableCount = m_xmlData.Tables.Count;
for (int i = 0; i < tableCount; i++)
{
DataTable dt = m_xmlData.Tables[i];
if (dt.TableName != "Module")
{
continue;
}
int rowCount = dt.Rows.Count;
for (int j = 0; j < rowCount; j++)
{
DataRow row = dt.Rows[j];
}
}
At this point, I'm kinda stuck I've looked around on CP but I've not been able to find any references to READING data from the dataset. I tried tracing in with the debugger to try to find out where to drill down, but I guess I'm just missing it.
Any help?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Use
myrow[int] to read the value of a field based on its ordinal position
and
myrow[string] to read the value of a field based on its name
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Yup - I was allowing intellisense to lead me astray.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: I was allowing intellisense to lead me astray
And there was the problem - intellisense. There's no sense in intellisense.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I have made a vb.net project and I used SQL Server Express for my database..
The project (when built and installed) can't be used remotely. But it can be installed, for example, on 2 computers. But what I need to do is to just share the database on my SQL server from the 1st computer to the 2nd.
This is because if I change the information inside the database from the 1st computer, the 2nd computer can also view the same database as the 1st one for them to acquire the same information from the database.
My question is.. Can I share my Database even if I'm using SQL Server 2005 Express Edition?
How will it be possible?
|
|
|
|
|
Any know why I can't log on to a SQL Server on a Windows 2003 machine, using Windows authentication, from my Vista machine. If I remote desktop onto the server I can, so I know my account is valid in SQL.
-- modified at 9:18 Friday 9th November, 2007
|
|
|
|
|
I have Vista, Sql management studio, and I can connecto to my win2003 / Sql Server. Sure its not another problem? Maybe Remote Connections not allowed on the server, this is maybe why you can login in remote?
|
|
|
|
|
I can log in remotely using SQL Server authentication.
|
|
|
|
|
Brady Kelly wrote: remotely
Brady Kelly wrote: If I remote desktop onto the server I can
Remote connections or remote desktop? Did you enabled remote connections on the server?
|
|
|
|