Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ò»¸öSQLÎÞÏÞ¼¶Ê÷ÐÍ´æ´¢¹ý³ÌʵÏÖÊ÷ÐͽṹÊý¾ÝÅÅÐò

ÎÒÃÇÔÚƽ³£µÄϵͳ¿ª·¢Öг£³£»áÓöµ½ÏñÎÞÏÞ¼¶·ÖÀàÕâÑùµÄÊ÷ÐͽṹÊý¾Ý£¬ÏÖÌṩһ¸ö¿ÉÓõÄÊý¾Ý¿â´æ´¢¹ý³Ì£¬¿ÉÒÔÍê³ÉÊ÷ÐͽṹÊý¾ÝµÄÅÅÐò¡£
»·¾³£ºwindows7+Sql Server 2008
˵Ã÷£ºÏÂÃæ´úÂëÒѾ­×ª»»³ÉSql server2000µÄ½Å±¾£¬´¦ÀíЧ¹ûÈçÏ£¬¿´sortname×ֶνá¹û,´úÂë¾­¹ý²âÊÔ¡£
´´½¨Ê÷Ðͱí
CREATE TABLE [dbo].[categories](
[category_id] [int] IDENTITY(1,1) NOT NULL,
[parent_id] [int] NULL,
[category_name] [varchar](500) NULL,
CONSTRAINT [PK_categories] PRIMARY KEY CLUSTERED
(
[category_id] ASC
) ON [PRIMARY]
) ON [PRIMARY]
GO
²åÈë²âÊÔÊý¾Ý
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (1, 0, CONVERT(TEXT, N'A'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (2, 0, CONVERT(TEXT, N'B'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (3, 1, CONVERT(TEXT, N'AA'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (4, 3, CONVERT(TEXT, N'AAA'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (5, 2, CONVERT(TEXT, N'BB'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (6, 1, CONVERT(TEXT, N'AA2'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (7, 1, CONVERT(TEXT, N'AA3'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (8, 3, CONVERT(TEXT, N'AAA2'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (9, 4, CONVERT(TEXT, N'AAA3'))
INSERT [dbo].[categories] ([category_id], [parent_id], [category_name]) VALUES (10, 2, CONVERT(TEXT, N'BB2'))
´´½¨´æ´¢¹ý³Ì£¬±íÖеÄlevelΪ¼¶±ðÉî¶È£¬Í¨¹ýÉú³ÉµÄÁÙʱ±íÓë·ÖÀà±í¹ØÁªÏÔʾ½á¹û¡£
CREATE PROCEDURE [dbo].[Get_TreeData]
AS
BEGIN
--´´½¨ÁÙʱ±í
create table #tmp_table (id int,[level] int)

declare @LevelValue int
set @LevelValue=0
insert #tmp_table select 0,@LevelValue
--½«Êý¾ÝдÈëµ½ÁÙʱ±í
while @@rowcount>0
begin
set @LevelValue=@LevelValue+1


Ïà¹ØÎĵµ£º

Óû§saµÇ¼ʧ°Ü,¸ÃÓû§Óë¿ÉÐÅsql serverÁ¬½ÓÎÞ¹ØÁª

SQLSERVER 2005²ÉÓÃ'SQLSERVERÉí·ÝÑéÖ¤'È¥µÇ¼, ³ö´íµÄÔ­ÒòÊÇ:'Óû§ 'sa' µÇ¼ʧ°Ü¡£¸ÃÓû§Óë¿ÉÐÅ SQL Server Á¬½ÓÎÞ¹ØÁª'.½ñÌìÉÏÍøÉϲéÁË°ëÌì²Å¸ã¶¨µÄ¡£
¾ßÌåµÄ·½·¨ÊÇ£º ¡¡¡¡
1£º´ò¿ªSQL Server Manager¹ÜÀíÆ÷£¡ÔÚ×óÃæÕÒµ½ ‘°²È«ÐÔ’ µ¥»÷ÓÒ¼ü Ñ¡Ôñ‘н¨”£¬“µÇ¼” µ¯³öÒ»¸ö¶Ô»°¿ò£¬Ô ......

SQL·Ö×éÅÅÐò

½ñÌìÓöµ½¸öÓÐÒâ˼µÄÎÊÌ⣬ÊÇÒ»¸ö·Ö×éÅÅÐòµÄÎÊÌ⣬²»¹ýÒªÇó·Ö×éºÍ·Ö×é¼äÒ²ÒªÅÅÐò£¬Èç¹ûÕâ¸ö×éÄÚÓÐÒ»ÌõÊý¾ÝÊÇ×î½ü¸üеģ¬ÄÇôÕâÕû¸ö×鶼Ӧ¸ÃÅÅÔÚÇ°Ãæ¡£
ÏÂÃæÒÔOracleµÄHRʾÀýSchemaÖеÄemployees±íΪÀý£º
Óï¾ä°´²¿ÃÅ·Ö×飬·Ö×éÖ®¼äµÄÅÅÐòÊÇÕâÑùµÄ£ºÈç¹ûÕû¸ö·Ö×éÖÐÓÐÒ»¸öÔ±¹¤µÄhire_dateÊÇ×îеģ¬ÄÇôÕâ¸ö·Ö×é¾ÍÓ¦¸ÃÅÅÔÚÆä ......

×î¼òµ¥µÄSQL ServerÊý¾Ý¿â´æ´¢¹ý³Ì·ÖÒ³


×î¼òµ¥µÄSQL ServerÊý¾Ý¿â´æ´¢¹ý³Ì·ÖÒ³
 
·¢²¼Ê±¼ä£º2008.07.02 05:11     À´Ô´£ºÈüµÏÍø    ×÷ÕߣºAlizze
¡¾ÈüµÏÍø£­IT¼¼Êõ±¨µÀ¡¿×î¼òµ¥µÄSQL ServerÊý¾Ý¿â´æ´¢¹ý³Ì·ÖÒ³:
1.Ö»ÐèÒªÌṩSqlÓï¾äºÍÿҳµÄ¼Ç¼Êý,Ò³Êý¾Í¿ÉÒÔÁË
2,Ëٶȳ¬¿ìÓ´,100W¼Ç¼1~3Ãë¾Í·Ö³öÀ´ÁË
......

SQL SERVER 2000 °²×°Ìáʾ"Ò»°ãÐÔÍøÂç´íÎó"

 ½ñÌì°²×°SQL SERVER 2000 ¸öÈ˰棬°²×°×îºóµ¯³ö´íÎó¶Ô»°¿ò£º
“°²×°³ÌÐòÅäÖ÷þÎñÆ÷ʧ°Ü¡£²Î¿¼·þÎñÆ÷´íÎóÈÕÖ¾ºÍC:\windows\sqlstp.log”£¬´Ó¶øÎÞ·¨°²×°¡£
µ½¾ßÌåµÄĿ¼²é¿´ÏÔʾ"Ò»°ãÐÔÍøÂç´íÎó"£¬ÔÚÍøÉÏËÑË÷ÎÊÌâÔ­Òò¼°½â¾ö·½°¸ÈçÏ£º
´ËÎÊÌâÊôÓÚsql serverµÄbug, GetComputerName ÓÃÓÚ»ñÈ¡±¾µØ¼ÆËã»úÃû¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ