|
Hi,
I have a table with 2,000,000 records and there is no way for me to filter it by range.
I was able to get the first 1,000,000, my problem is to get the next 1,000,000 without any duplicates from the first 1M records. Any Idea.
SELECT TOP 1000000 * from Table1
how about the next 1M??
Pls..
Dabsukol
|
|
|
|
|
Select top 1000000 colname from
(
Select top 2000000 colname from urtable order by colname desc
) T
order by colname asc
G. Satish
|
|
|
|
|
In short
For First 1000000
Select top 1000000 colname from urtable order by colname ASC
For Next 1000000
Select top 1000000 colname from urtable order by colname DESC
ZAK
|
|
|
|
|
Oops just added another record - this is a Microsoft answer, technically correct practically useless.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Select top 1m records order by ID
Get the last ID in the first set (you do have an ID field)
Select the top 1m records where ID > last ID
You can also look into Row_Number in SQL Server, this will eliminate the detect requirement but is more complex in the select. I would assume you are processing the 1m records and therefore detecting the last ID would be trivial.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am using postgreSQL 8.0 (pgAdmin III). Whenever I create a trigger, an error "There is no in-built function 'funtion name'".
What the actual problem is with the trigger or postgresql?
Please send me the solution..
Thank u.
|
|
|
|
|
Hey,
I want to access letters in strings selected from DB.
I would like to do something like that:
SELECT word FROM dictionary
WHERE
-- and now the pseudo-code part:
word[0] is in {'a','e','o','u','y'}
AND word[1] is in {'b','c','d'}
where word[0] means first letter in selected word, word[1] second letter etc.
Is it possible to do in MS SQL?
|
|
|
|
|
Look into CHARINDEX and SUBSTRING
pseudo code ...
IF (CHARINDEX(SUBSTRING(WORD,1,1),'aeiou',1) > 1) then
found it
End if
|
|
|
|
|
big thanks!!! I haven't test it yet but it seems to be the solution
|
|
|
|
|
You should use the Like keyword:
select word from dictionary
where word like '[aeouy][bcd]%'
Wout Louwers
|
|
|
|
|
Wow ! That is a neat way of using the "like" comparison. I like it!
|
|
|
|
|
You got my 5.
Briliant.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Hi Experts
iam having two sqlservers .where i want to move entire table from the server1 database with the data to anothers server(server2) datbase using query .plz guide me......
regards
venu
modified on Friday, July 24, 2009 5:55 AM
|
|
|
|
|
You could use SSIS or linked servers.
|
|
|
|
|
i know using linked servers but using query i shuld get it becoz this query is used in c#..... to execute so many tables ...
|
|
|
|
|
Hey Venu,
Please elaborate a bit more on what exactly are you looking for inside your C# code.
Are you trying to transfer data between different databases having identical schema from inside your C# code or you want to query different database at the same time???
Robin
|
|
|
|
|
hi robin.
actual i want to transfer the entire table structure along with datafrom local sqlserver to hosting sqlserver using c#
|
|
|
|
|
This is usually achieved by backing up the local database and restoring it on the host.
Additionaly you can script the database and uses SSIS to move the data
Or use SQL Compare from http://www.red-gate.com/index.htm?gclid=CLDSwcDM6JsCFcItpAod-kAU5Q to move the code and Data Compare to move the data. This is what I use.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi venu,
server1 database structure is static or dynamic??
icanmakeiteasy
|
|
|
|
|
|
then if the table structure is static create a script file for server1 database.., read that file from c#, then manipulate it...
icanmakeiteasy
|
|
|
|
|
Help!!!
How can I find specific value from a field in a select list where the specific value varies in position.
ex;
Record1 A-'Telec:144'
Record1 B-'Telecom:145'
How to find the ":" using the SQL so I can get the 2 value in one field.. pls..
Dabuskol
Dabsukol
|
|
|
|
|
Use substring to get the characters, and charindex to find the :
declare @a varchar(20)
set @a = 'Telec:144'
select substring(@a,1,charindex(':',@a)-1),substring(@a,charindex(':',@a)+1,len(@a))
will return Telec for the first 1 and 144 for the 2nd
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
You are correct... Thanks for the immediate reply you save me on my last minute.
Thanks...
Dabsukol
|
|
|
|
|
No problem
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|