Click here to Skip to main content
15,888,148 members
Home / Discussions / Database
   

Database

 
AnswerRe: need code sample Pin
japel5-Oct-06 0:44
japel5-Oct-06 0:44 
Questionselect with TOP and COUNT Pin
CandyMe4-Oct-06 17:26
CandyMe4-Oct-06 17:26 
AnswerRe: select with TOP and COUNT Pin
albCode4-Oct-06 21:06
albCode4-Oct-06 21:06 
GeneralRe: select with TOP and COUNT Pin
CandyMe4-Oct-06 22:05
CandyMe4-Oct-06 22:05 
GeneralRe: select with TOP and COUNT Pin
albCode4-Oct-06 22:08
albCode4-Oct-06 22:08 
AnswerRe: select with TOP and COUNT Pin
Eric Dahlvang5-Oct-06 5:22
Eric Dahlvang5-Oct-06 5:22 
GeneralRe: select with TOP and COUNT Pin
CandyMe5-Oct-06 18:00
CandyMe5-Oct-06 18:00 
GeneralRe: select with TOP and COUNT Pin
CandyMe5-Oct-06 19:41
CandyMe5-Oct-06 19:41 
I figured it some 2 hours after my last reply.
I decided to create a temp table where I'd do my select top
then just count the number of rows in that temp table
with the whereclause, ofcourse

CREATE TABLE #RowCount(SubscriberId INT)

EXEC ('INSERT #RowCount' + ' SELECT TOP ' + @Top + ' (SubscriberId) FROM ' + @TableName)

--get total pages
EXEC ('SELECT (COUNT(*) - 1)/' + @SizeString + ' + 1 AS PageCount FROM #RowCount')

--get total number of rows
EXEC ('SELECT COUNT(*) FROM #RowCount')

so if i selected top 10000 and only 3000 passed the condition
totalrowcount is 3000; otherwise, if i selected top 2500 and 3000 passed the condition, totalrowcount is 2500

thanks! Suspicious | :suss: OMG | :OMG:

Gerri

AnswerRe: select with TOP and COUNT Pin
templarx5-Oct-06 22:08
templarx5-Oct-06 22:08 
GeneralRe: select with TOP and COUNT Pin
CandyMe7-Oct-06 2:17
CandyMe7-Oct-06 2:17 
Questiondatetime Pin
lakshmi_sri4-Oct-06 15:01
lakshmi_sri4-Oct-06 15:01 
AnswerRe: datetime Pin
Edbert P4-Oct-06 16:39
Edbert P4-Oct-06 16:39 
AnswerRe: datetime Pin
Eric Dahlvang5-Oct-06 5:11
Eric Dahlvang5-Oct-06 5:11 
QuestionQuery Builder to make stored procedures? Pin
eggsovereasy4-Oct-06 10:43
eggsovereasy4-Oct-06 10:43 
Questiontext , ntext datatypes ( PLEASE HELP ) Pin
abdelhameed814-Oct-06 9:22
abdelhameed814-Oct-06 9:22 
AnswerRe: text , ntext datatypes ( PLEASE HELP ) Pin
Mark Salsbery4-Oct-06 10:44
Mark Salsbery4-Oct-06 10:44 
GeneralRe: text , ntext datatypes ( PLEASE HELP ) Pin
abdelhameed814-Oct-06 21:51
abdelhameed814-Oct-06 21:51 
GeneralRe: text , ntext datatypes ( PLEASE HELP ) Pin
Mark Salsbery5-Oct-06 6:26
Mark Salsbery5-Oct-06 6:26 
AnswerRe: text , ntext datatypes ( PLEASE HELP ) Pin
Jerry Hammond5-Oct-06 4:20
Jerry Hammond5-Oct-06 4:20 
QuestionDelete Row Count Pin
Skanless4-Oct-06 9:21
Skanless4-Oct-06 9:21 
AnswerRe: Delete Row Count Pin
Edbert P4-Oct-06 16:45
Edbert P4-Oct-06 16:45 
QuestionColumn Length Pin
Guinness4Strength4-Oct-06 7:50
Guinness4Strength4-Oct-06 7:50 
AnswerRe: Column Length Pin
Mark Salsbery4-Oct-06 10:56
Mark Salsbery4-Oct-06 10:56 
GeneralRe: Column Length Pin
Guinness4Strength4-Oct-06 11:00
Guinness4Strength4-Oct-06 11:00 
GeneralRe: Column Length Pin
Mark Salsbery4-Oct-06 11:49
Mark Salsbery4-Oct-06 11:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.