🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.comp.database
17 messages
17 total messages Started by ����(��) Sun, 19 Mar 2006 04:44
��select�����top������ʹ�ñ�����
#33
Author: ����(��)
Date: Sun, 19 Mar 2006 04:44
25 lines
2266 bytes
���봴������һ���洢��̵�˵��
������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
�� 8 ��: '@pagesize' �������﷨����
������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
�� 12 ��: '@pagesum' �������﷨����
Ӧ����ô�������
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create proc pageview
	@pagenum int=1,
	@pagesize int=10
as
declare @pagesum int
set @pagesum = @pagenum * @pagesize

select top @pagesize
gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
from gbook inner join [user] 
on gbook.u_id =[user].[id]
WHERE (gbook.[id] NOT IN 
(SELECT TOP @pagesum gbook.[id] 
from gbook inner join [user] 
on gbook.u_id =[user].[id] 
ORDER BY gbook.[id] desc)) 
ORDER BY gbook.[id] desc
go
Re: ��select�����top������ʹ�ñ�����
#34
Author: Yanni
Date: Sun, 19 Mar 2006 11:21
1 lines
1218 bytes
2005��֧�֡� 
Re: ��select�����top������ʹ�ñ�����
#35
Author: ����(��)
Date: Sun, 19 Mar 2006 11:49
7 lines
1562 bytes
���ҵ�SQL��2000զ�찡��
��Sun, 19 Mar 2006 19:21:36 +0800ʱ,"Yanni"�� ��Re:
��select�����top������ʹ�ñ����� ���з���Ĵ���:
--

>2005��֧�֡� 
>
Re: ��select�����top������ʹ�ñ�����
#36
Author: element
Date: Sun, 19 Mar 2006 13:28
11 lines
1422 bytes
�ö�̬SQL

"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441d4541.219355@cnusenet.3322.org...
> ���ҵ�SQL��2000զ�찡��
> ��Sun, 19 Mar 2006 19:21:36 +0800ʱ,"Yanni"�� ��Re:
> ��select�����top������ʹ�ñ����� ���з���Ĵ���:
> --
>
>>2005��֧�֡�
>>
> 
Re: ��select�����top������ʹ�ñ�����
#37
Author: ����(��)
Date: Sun, 19 Mar 2006 14:08
17 lines
2076 bytes
զ����̬������
��Sun, 19 Mar 2006 21:28:39 +0800ʱ,"element"�� ��Re:
��select�����top������ʹ�ñ����� ���з���Ĵ���:
--

>�ö�̬SQL
>
>"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441d4541.219355@cnusenet.3322.org...
>> ���ҵ�SQL��2000զ�찡��
>> ��Sun, 19 Mar 2006 19:21:36 +0800ʱ,"Yanni"�� ��Re:
>> ��select�����top������ʹ�ñ����� ���з���Ĵ���:
>> --
>>
>>>2005��֧�֡�
>>>
>> 
>
Re: ��select�����top������ʹ�ñ�����
#38
Author: element
Date: Sun, 19 Mar 2006 14:35
38 lines
2488 bytes
create proc pageview
@pagenum int=1,
@pagesize int=10
as
declare @pagesum int
set @pagesum = @pagenum * @pagesize

declare @sql varchar(8000)
set @sql='select top '+cast(@pagesize as varchar)+' 
gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id] from gbook 
inner join [user] on gbook.u_id =[user].[id]
WHERE (gbook.[id] NOT IN (SELECT TOP '+cast(@pagesum as varchar)+' 
gbook.[id] from gbook inner join [user] on gbook.u_id =[user].[id]
ORDER BY gbook.[id] desc))
ORDER BY gbook.[id] desc'
exec(@sql)
go


"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441d65de.8568400@cnusenet.3322.org...
> զ����̬������
> ��Sun, 19 Mar 2006 21:28:39 +0800ʱ,"element"�� ��Re:
> ��select�����top������ʹ�ñ����� ���з���Ĵ���:
> --
>
>>�ö�̬SQL
>>
>>"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441d4541.219355@cnusenet.3322.org...
>>> ���ҵ�SQL��2000զ�찡��
>>> ��Sun, 19 Mar 2006 19:21:36 +0800ʱ,"Yanni"�� ��Re:
>>> ��select�����top������ʹ�ñ����� ���з���Ĵ���:
>>> --
>>>
>>>>2005��֧�֡�
>>>>
>>>
>>
> 
Re: ��select�����top������ʹ�ñ�����
#39
Author: ����(��)
Date: Sun, 19 Mar 2006 14:46
24 lines
2187 bytes
�����ˣ���ΪʲôҪ�ȷ��ַ��ﰡ��
��Sun, 19 Mar 2006 22:35:26 +0800ʱ,"element"�� ��Re:
��select�����top������ʹ�ñ����� ���з���Ĵ���:
--

>create proc pageview
>@pagenum int=1,
>@pagesize int=10
>as
>declare @pagesum int
>set @pagesum = @pagenum * @pagesize
>
>declare @sql varchar(8000)
>set @sql='select top '+cast(@pagesize as varchar)+' 
>gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id] from gbook 
>inner join [user] on gbook.u_id =[user].[id]
>WHERE (gbook.[id] NOT IN (SELECT TOP '+cast(@pagesum as varchar)+' 
>gbook.[id] from gbook inner join [user] on gbook.u_id =[user].[id]
>ORDER BY gbook.[id] desc))
>ORDER BY gbook.[id] desc'
>exec(@sql)
>go
>
>
Re: ��select�����top������ʹ�ñ�����
#40
Author: element
Date: Sun, 19 Mar 2006 14:53
42 lines
3278 bytes
����EXEC����һ���÷���

ִ���ַ�
EXEC [ UTE ] ( { @string_variable | [ N ] 'tsql_string' } [ + ...n ] )
ʹ�ô��ַ�� EXECUTE ����
ʹ���ַ�������� (+) Ϊ��ִ̬�д������ַ�ÿ���ַ���ʽ������ 
Unicode �� non-Unicode ������͵Ļ�ϡ�
����ÿ�� [N] 'tsql_string' �� @string_variable ���ó��� 8,000 ���ֽڣ�SQL 
Server �﷨�������ж����ִ���ֻ�����߼������ռ�������ڴ档���磬������������ɳ� 16,000 �������������ַ�
EXEC('name_of_8000_char_string' + 'another_name_of_8000_char_string')

�� EXECUTE ���ִ��ǰ��������� EXECUTE ����ڵ���䡣
��ݿ⻷���ĸ��ֻ�� EXECUTE ������ǰ��Ч�����磬��������ӵ� EXEC ����ݿ⻷���� master��
USE master EXEC ("USE pubs") SELECT * FROM authors


"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441e6eb5.10831084@cnusenet.3322.org...
> �����ˣ���ΪʲôҪ�ȷ��ַ��ﰡ��
> ��Sun, 19 Mar 2006 22:35:26 +0800ʱ,"element"�� ��Re:
> ��select�����top������ʹ�ñ����� ���з���Ĵ���:
> --
>
>>create proc pageview
>>@pagenum int=1,
>>@pagesize int=10
>>as
>>declare @pagesum int
>>set @pagesum = @pagenum * @pagesize
>>
>>declare @sql varchar(8000)
>>set @sql='select top '+cast(@pagesize as varchar)+'
>>gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id] from gbook
>>inner join [user] on gbook.u_id =[user].[id]
>>WHERE (gbook.[id] NOT IN (SELECT TOP '+cast(@pagesum as varchar)+'
>>gbook.[id] from gbook inner join [user] on gbook.u_id =[user].[id]
>>ORDER BY gbook.[id] desc))
>>ORDER BY gbook.[id] desc'
>>exec(@sql)
>>go
>>
>> 
Re: ��select�����top������ʹ�ñ�����
#41
Author: ddddd
Date: Wed, 12 Apr 2006 03:30
2 lines
1145 bytes
3333333333
Re: ��select�����top������ʹ�ñ�����
#42
Author: ddddd
Date: Wed, 12 Apr 2006 03:31
28 lines
2226 bytes
"����(��)" <root@guohai.org.discuss> wrote in message
news:441de15c.10549329@cnusenet.3322.org...
> ���봴������һ���洢��̵�˵��
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
> �� 8 ��: '@pagesize' �������﷨����
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
> �� 12 ��: '@pagesum' �������﷨����
> Ӧ����ô�������
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> create proc pageview
> @pagenum int=1,
> @pagesize int=10
> as
> declare @pagesum int
> set @pagesum = @pagenum * @pagesize
>
> select top @pagesize
> gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> WHERE (gbook.[id] NOT IN
> (SELECT TOP @pagesum gbook.[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> ORDER BY gbook.[id] desc))
> ORDER BY gbook.[id] desc
> go
Re: ��select�����top������ʹ�ñ�����
#44
Author: ddddd
Date: Wed, 12 Apr 2006 03:32
1 lines
1096 bytes
uyiiui
top������ʹ�ñ���
#45
Author: ddddd
Date: Wed, 12 Apr 2006 03:32
1 lines
1075 bytes
asasaaaxsaa
Re: ��select�����top������ʹ�ñ�����
#46
Author: ddddd
Date: Wed, 12 Apr 2006 03:34
28 lines
2293 bytes
"����(��)" <root@guohai.org.discuss> wrote in message
news:441de15c.10549329@cnusenet.3322.org...
> ���봴������һ���洢��̵�˵��
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
> �� 8 ��: '@pagesize' �������﷨����
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
> �� 12 ��: '@pagesum' �������﷨����
> Ӧ����ô�������
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> create proc pageview
> @pagenum int=1,
> @pagesize int=10
> as
> declare @pagesum int
> set @pagesum = @pagenum * @pagesize
>
> select top @pagesize
> gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> WHERE (gbook.[id] NOT IN
> (SELECT TOP @pagesum gbook.[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> ORDER BY gbook.[id] desc))
> ORDER BY gbook.[id] desc
> go
Re: ��select�����top������ʹ�ñ�����
#47
Author: guocai
Date: Thu, 20 Apr 2006 03:17
28 lines
2238 bytes
����C�������
����(��) <root@guohai.org.discuss> wrote in message
news:441de15c.10549329@cnusenet.3322.org...
> ���봴������һ���洢��̵�˵��
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
> �� 8 ��: '@pagesize' �������﷨����
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
> �� 12 ��: '@pagesum' �������﷨����
> Ӧ����ô�������
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> create proc pageview
> @pagenum int=1,
> @pagesize int=10
> as
> declare @pagesum int
> set @pagesum = @pagenum * @pagesize
>
> select top @pagesize
> gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> WHERE (gbook.[id] NOT IN
> (SELECT TOP @pagesum gbook.[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> ORDER BY gbook.[id] desc))
> ORDER BY gbook.[id] desc
> go
Re: ��select�����top������ʹ�ñ�����
#50
Author: XWZ
Date: Fri, 21 Apr 2006 13:20
27 lines
2357 bytes
fffffffffffffffffffffffffffffff
"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441de15c.10549329@cnusenet.3322.org...
> ���봴������һ���洢��̵�˵��
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
> �� 8 ��: '@pagesize' �������﷨����
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
> �� 12 ��: '@pagesum' �������﷨����
> Ӧ����ô�������
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> create proc pageview
> @pagenum int=1,
> @pagesize int=10
> as
> declare @pagesum int
> set @pagesum = @pagenum * @pagesize
>
> select top @pagesize
> gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> WHERE (gbook.[id] NOT IN
> (SELECT TOP @pagesum gbook.[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> ORDER BY gbook.[id] desc))
> ORDER BY gbook.[id] desc
> go 
Re: ��select�����top������ʹ�ñ�����
#52
Author: XWZ
Date: Fri, 21 Apr 2006 13:22
27 lines
2242 bytes
cccccccccccccccccccccc
"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441de15c.10549329@cnusenet.3322.org...
> ���봴������һ���洢��̵�˵��
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
> �� 8 ��: '@pagesize' �������﷨����
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
> �� 12 ��: '@pagesum' �������﷨����
> Ӧ����ô�������
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> create proc pageview
> @pagenum int=1,
> @pagesize int=10
> as
> declare @pagesum int
> set @pagesum = @pagenum * @pagesize
>
> select top @pagesize
> gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> WHERE (gbook.[id] NOT IN
> (SELECT TOP @pagesum gbook.[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> ORDER BY gbook.[id] desc))
> ORDER BY gbook.[id] desc
> go 
Re: ��select�����top������ʹ�ñ�����
#54
Author: XWZ
Date: Fri, 21 Apr 2006 13:24
27 lines
2197 bytes
bndjskjdksjdsd
"С����(��)" <root@guohai.org.discuss> д����Ϣ����:441de15c.10549329@cnusenet.3322.org...
> ���봴������һ���洢��̵�˵��
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 8
> �� 8 ��: '@pagesize' �������﷨����
> ������: ��Ϣ 170������ 15��״̬ 1����� pageview���� 12
> �� 12 ��: '@pagesum' �������﷨����
> Ӧ����ô�������
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> create proc pageview
> @pagenum int=1,
> @pagesize int=10
> as
> declare @pagesum int
> set @pagesum = @pagenum * @pagesize
>
> select top @pagesize
> gbook.[id],gbook.title,gbook.neirong,[user].[name],[user].[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> WHERE (gbook.[id] NOT IN
> (SELECT TOP @pagesum gbook.[id]
> from gbook inner join [user]
> on gbook.u_id =[user].[id]
> ORDER BY gbook.[id] desc))
> ORDER BY gbook.[id] desc
> go 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads