|
I want to display 10th record to 20th record from a table. I have no any field to store the recordno. I am using sql Server2000.
Bharat Bhusanam
|
|
|
|
|
Hi,
If you have some ID field, you can do something like this ---
If you have emp table like this --
Emp_Id Emp_Name Emp_Salary
1 ABC 2500.0000
2 ACD 1000.0000
3 AND 6000.0000
4 SVN 10000.0000
5 AYK 8500.0500
6 AT 8500.0000
7 NM 8500.0000
8 AK 5000.0000
9 VD 20000.0000
10 VP 100.0000
11 CV 8500.0000
then you can do something like this--
SELECT *
FROM (SELECT TOP 3 *
FROM (SELECT TOP 5 *
FROM EMP
ORDER BY EMP_ID ASC) AS T10
ORDER BY EMP_ID DESC) AS T5
ORDER BY EMP_ID ASC
this will return records from 3 to 5
you can change values dynamically (from program) to get desired results
hope i am clear !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
|
iam selecting the date from calender control into the textbox.when iam inserting into database(sql2ooo) it is showing the time also.i dont want to display time in the frontend(datagrid).what should i do?
ravi shankar
|
|
|
|
|
hi,
use something like this
select convert(varchar,getdate(),101)
you can use your column name instead of getdate()
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
|
I wnat to know how to access the sql server 2000 errors in vb.net.
Also how to handle these errors in the client place.where to save them.
|
|
|
|
|
hi,
i think for each error that is fired from sql server you get exceptions in .net? You can handle them there.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hi,
Is there anyway to append query result rows together in SQL? For example, i want to append/concatenate all rows with same id.
Table:
id column1 column2 column3
1 a b c
1 d e f
2 g h i
2 k l m
Result:
id column1 column2 column3 column4 column5 column6
1 a b c d e f
2 g h i k l m
I'll appreciate any help.
Thanks
|
|
|
|
|
Are you wanting to update the table to have "6" columns with a value in each, do you want to just view the "results" in 6 columns or do you want 1 column with all values "appended" together?
|
|
|
|
|
Thank you for your response. I want to view the result in 6 columns.
|
|
|
|
|
Hope this is the right forum. If not, please feel free to direct me elsewhere...
I'm trying to build a suite of reports using Reporting Services 2005. At the most general level, there will be a report of Year-to-date sales data - pretty standard stuff; revenue, expense, net revenue, revenue per unit, etc. comparing current to previous year. The national totals will be at the top of the report. Beneath that will be the same data for each of 6 Sales regions. I have made the name of each region click-through to a similar report for that region. On the regional report, the top line is the regional totals, with the same info for each sales rep beneath it.
I'm simplifying a bit to keep the example simple. There are additional details included in groups on each of the reports which make combining them into a single report impractical.
Given the amount of calculations involved, and the fact that the data will only be updated monthly, this is a classic case where snapshots would help me display the pages more quickly.
I've got the national report running on a snapshot. The problem is with the regional report; since the click-through passes that report a parameter, I am trying to get the snapshot to run for each region. If I enter a single parameter in Properties -> Parameters, it only runs the snapshot for that region. I tried making it a multi-value parameter, but then clicking on the region name always brings me to the data for the region that is listed first, regardless of which region was clicked.
I'm hoping that there is a way that I can get the snapshots to run for each region, so the regional report will display in a timely fashion.
Thanks.
|
|
|
|
|
How can i get the phonenumbers starting with 98494 series from the database?Plz i need a query for this.
|
|
|
|
|
Select phonenumbers from PhoneBook Where phonenumbers LIKE '98494%'
sameer
|
|
|
|
|
|
Hi,
I am trying to set a property for the connection string: Auto Translate.
As I am using SQLconnection object rather than OLE or ODBC, is there any way for me to turn off the Auto Translate option? Otherwise, I would get all the crazy characters for my Big5 Chinese words from Database. This problem was solved by setting that auto translation off for ODBC when i was still using asp when we first developed the application. Due to the performance issue, we switched to SQLconnection rather than ODBC.. is there any way to come around for this problem?
Given condition: SQL Server 2000 and database structures cannot be changed.
I am very new to .net and your help will be very appreicated! Thanx!!
|
|
|
|
|
This one is driving me mad - hope someone can help.
I have a VB.Net app in VS2005 and I wanted to bind it to a SQL Server 2005 table so I dragged a DataGridView control onto a form and defined the datasource to come from the table I want to use and VS2005 went ahead and generated the XSD and the screeds of code which is great.
I then refined my table (using SQL Server Studio, not VS2005), adding a new column and changing a couple of column types in the DB table but I can't see ANY way to get VS2005 to get the updated table except to trash the generated Dataset, BindingSource and TableAdapter objects and do the whole binding exercise all over again! I've tried right-clicking and doing a refesh wherever I can that option but it never updates the code behind or the XSD. Now, I seem to remember in VS2003 there was a "Regenerate" command (or something like that) so where the heck is the equivalent in VS2005? Right-clicking on the XSD file in solution explorer has an option "Run custom tool" which I think runs "MSDataSetGenerator" but it doesn't seem to refresh or regenerate anything!
I've searched high and low and looked everywhere but I can't see any way to keep the VS2005 table concurrent with the underlying DB table - surely with the integration of SQL Server and .Net 2.0 I'm not expecting the impossible?
Can someone help me out here and tell me what I'm missing?
TIA...
Mike
-- modified at 18:00 Saturday 4th November, 2006
|
|
|
|
|
Hi
How can i get column names of a given table from a MS Access DB? Is there any query to do it?? Please help.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Look at the answers to your previous post.[^]
Chandra
|
|
|
|
|
Hi
I know how to get column name in sql server.U try it in access
Hope it will be working.
SELECT COL_NAME(OBJECT_ID(Tablename), index of column)
Thank
monika
software developer
|
|
|
|
|
Hi;
How could I find out if the record im delteing from a table is related to other tables in my database.
Say if I have a Table A and Table B and there is a record in table A which is related to table B data then dont delete it and if no then deletion is ok.
Is there any specific sql query for that?
Thanks,
Riazi
-- modified at 8:26 Saturday 4th November, 2006
|
|
|
|
|
delete from TableA
where not exists(select IDColumn
from TableB
where TableB.IDColumn = TableA.IDColumn)
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi Eric;
Thanks for the reply. But this is not what I wanted. I know I could use this simple sql but what if I have more tables and want to check them all. I thougt there is a specific query to do this simpler for me. you know a command like "SELECT RELATED(TABLE A) FIELDS FROM ALL TABLES" and get the results if any thing related.
Is there any thing like that at all?
Thanks again
Riazi
|
|
|
|
|
EricDV gave you a valid answer. You have to repeat it for each related table. You could create a stored procedure that does a general thing by have it query the database schema and have it generate and execute the SQL you need but that would take some time to put together.
|
|
|
|
|
I'm having a quite known problem, but I simply cannot find my way around it.
There's a DataSet wich holds the data collected from the database. When I add a row on a table in the dataset, and I update the database with the changes from the DataSet, the database id and the dataset row id are different.
I've tried ways of working with DataRowVersions and getting back an identity from the db(stored proc), but no luck.
Could anyone point me to a good example or way of working with this problem?
Thanks
|
|
|
|