|
hi
thanks for answering..can u tell me how to write(modify) this query without using TOP keyword.
pintoo
|
|
|
|
|
I wonder why you don't want to use TOP, but here's another version:
SELECT Name, Salary
FROM TableName alias1,
WHERE 4 < (SELECT COUNT(*)
FROM TableName alias2
WHERE alias2.Salary > alias1.Salary)
Mika
|
|
|
|
|
I think that the Top will be the best choice, unless your using something other than SQL Server.
If your using MySQl, use Limit 3 at the end of the statement.
Select Salary
From tablename
Order By Salary Desc
Limit 3
I think any other method will cause overhang.
|
|
|
|
|
A view is a virtual table that consists of columns from one or more tables. Though it is similar to a table, it is stored in the database. It is a query stored as an object.
So what is the use of Views because i think one can do anything and everything with the tables without having Views...........
Plz explain ?????????
|
|
|
|
|
|
Views are faster and they hide the query complicity.
|
|
|
|
|
Hi,
Please go though the following articles for better explaination:
Article1[^]
Article2[^]
Hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Putting it simply, a View is a boon to security and simplifies your access to information. It's quicker in many respects than a full blooded table scan.
With a View we can grant access to the View without granting access to the underlying table thus limiting someone to only the data we wish them so access. Case in point, we could give a User access to a View from an employee table that omits SS# or salary information.
Does that answer your question?
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
View was designed for two purposes, security and query simplification as many people has already pointed out. Articles provided clarify these aspects well. However, a common misbelief is that a view is faster than a query without a view. This is not always true. There are several situations where views are slower than plain select statements.
When a view is created, it's stored as an object which gives the optimizer a possibility to create a better plan for the query. When executing view, some (but not all) of the parsing and optimization can be skipped and this can result in (small) performance benefit.
However creating a view does not significantly modify execution plan. For example if SELECT * FROM Customers results in a full table scan, the situation isn't typically any different if the statement is wrapped inside a view. Execution of the view can be boosted in several ways but they always require structural changes in the database (materializing, different kinds of indexing, partitioning, federations etc) so they require administration.
Since optimizer must be very careful when calculating permutations that it doesn't risk correct results, many default SQL optimizations are easily skipped if a query is executed against a view. Typical example is so called predicate pushing when optimizer tries to apply a condition as soon as possible. However if a view is defined, predicate pushing may not be used since it would modify view results hence modifying the overall results. This is just one of the many examples when query against a view can be (significantly) slower that plain query.
Mika
|
|
|
|
|
Hi,
Can any body suggest me how to take backup file from 2005 to 2000 in sql server.
Ex: I have taken backup from Sql2005...
I want to restore in 2000.
Is it possible? If yes please suggest me.
other wise
is there any other way to do this task.
|
|
|
|
|
Ashish Kumar Vyas wrote: Can any body suggest me how to take backup file from 2005 to 2000 in sql server.
You cannot.
Ashish Kumar Vyas wrote: is there any other way to do this task.
You could look for a scripting tool. Modify the script to remove any SQL Server 2005 enhancements then run the script on SQL Server 2000 - It is still risky though.
|
|
|
|
|
i think you can not directly restore bak from SQL 2005 to 2000
but if you dont want data n want only structure n procedures of database
den u can use Generate script
|
|
|
|
|
thanx for replying...
but I need data too..
|
|
|
|
|
here is no "Restore" functionality, but there is a workaround to copy 2005 databases to 2000:
Right-click on DB -> tasks -> generate scripts
select DB and click "script all objects...", hit next
select any options you want, specifically changing "script for server version" to SQL Server 2000
next through and run the script
Now just export data from the 2005 database to the newly-created 2000 database.
Right-click on DB -> tasks -> export...
set source and hit next
set destination and hit next
select "copy data from one or more tables", hit next
select all, check "optimize for many tables" and "run in a transaction"
you may have to edit each table mapping and check "enable identity insert"
next through to finish
plz check it out
i hope dis will work 4 u
Reasons are not Important but Results are Important
modified on Tuesday, August 19, 2008 7:12 AM
|
|
|
|
|
No offence but
Tripathi Swati wrote: hope dis will work 4 u
must be
Hope this will work for you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
|
I mean it would be better if you try to write more regular writing english.
Example instead of
Tripathi Swati wrote: wht
you have to write what and not wht
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Thanx a lot for your valuable suggestion...
is it working for sql server 2005 express edition.
I have express edition..
can u assist me for express edition.
|
|
|
|
|
In express edition you can not restore.
Reasons are not Important but Results are Important.
Swati
|
|
|
|
|
Tripathi Swati wrote: In express edition you can not restore.
Why not
Mika
|
|
|
|
|
Hi,
I use lower() and upper() for my varchars in sql.
I want to lower the 1st string, exception for the 1st char (that i want to upper)
For the 2nd string i want to upper all chars.
Like this:
Helen HUNT
Peter DOUGLAS
How i do this?
nelsonpaixao@yahoo.com.br
|
|
|
|
|
here it is:
<br />
<br />
DECLARE @val AS VARCHAR(255)<br />
SET @val='name surname'<br />
<br />
SELECT UPPER(SUBSTRING(@val,1,1))+LOWER( SUBSTRING(@val,2,CHARINDEX(' ',@val)-1))+<br />
UPPER (SUBSTRING(@val, CHARINDEX(' ',@val)+1,LEN(@val)))
Result is:
Name SURNAME
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Can a partition function reference a database Schema?
It doesn't seem logical to me, but...
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|
|
Could you specify a little bit more what you mean by referencing a schema?
Mika
|
|
|
|
|
Sorry for the delay in getting back. Thank you for asking, but I found the answer. For SQL 2005 the answer is no.
“If we are all in agreement on the decision - then I propose we postpone further discussion of this matter until our next meeting to give ourselves time to develop disagreement and perhaps gain some understanding of what the decision is all about.”-Alfred P. Sloan
|
|
|
|